One of the example projects listed by Lightbend is not working for larger files

不问归期 提交于 2021-01-28 21:54:29

问题


I did post this same question at LightBend's discussion group here, but cannot get an answer that solves my issue. Since I am really anxious to know what is the problem here, let me again post this question here, hoping a big audience group might mean a better chance of getting an answer.

So basically, at this page, https://developer.lightbend.com/start/?group=play, we can find a list of example Play! projects. Among these examples, there is one project is about Java File Upload (https://developer.lightbend.com/start/?group=play&project=play-samples-play-java-fileupload-example). This project teaches the readers how to create a file uploader using Akka Streaming idea, therefore even when the file is large, we can still safely upload it without reading it as a whole into the memory.

This project works for small files, but when I try to upload a larger file, for example, which has a size about 15M, I will get a page says “The connection was reset”.

Now, in this example project, inside application.conf file, I see this,

# **Sets the maximum file size that can be uploaded to 1024k.**
# https://www.playframework.com/documentation/2.8.x/JavaBodyParsers#Content-length-limits
play.http.parser.maxMemoryBuffer=1024k

Indeed - if I upload any file that is smaller than 1024k, it will work, but anything larger than that, it will not work.

Now, I am very confused. Notice 1024k is the size of maxMemoryBuffer! This does not make sense to me because the whole idea of “streaming it”, is to be able to stream it with a much smaller memory buffer and without reading the whole file into the memory first. But the file size has to be smaller than play.http.parser.maxMemoryBuffer??? this makes me think it might just read the whole file into memory …

I know I am wrong, but just don't know where I am wrong and what I have missed. I hope someone with a better idea can see this question and will kindly let me know what is happening… Thank you so much for the help!

UPDATE:

Let me add a little bit more information here. So if I upload a file that is larger than play.http.parser.maxMemoryBuffer, the error message is the following (using Chrome):

This site can’t be reached
ERR_CONNECTION_ABORTED

and here is what I see in the log:

[debug] a.h.i.u.StreamUtils$DelayCancellationStage$$anon$11 - Delaying cancellation for 1 minute

Hope this can be of some help??

来源:https://stackoverflow.com/questions/65854900/one-of-the-example-projects-listed-by-lightbend-is-not-working-for-larger-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!