-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large files get truncated after 2^31 -1 bytes #630
Comments
Need more information, as it's not clear what you refer to. A "stream greater than Can you attach a reproducible use case ? |
Note: this issue is also mentioned at http://stackoverflow.com/questions/37731778/sending-large-files-with-scalatra-server-ends-after-231-1-bytes |
This is HTTP/2 (so, what's the non-websocket version of an endpoint?) Here is the code that can repro it:
I made the file using We are using jetty 9.3.9.v20160517. Sorry, I posted this same issue on stack overflow first. |
After some digging, it looks like scalatra tries to do this: |
@jamesatha yes it's a Scalatra bug, since the |
Some hints to the problem (looks like a scalatra bug, assuming that |
@jamesatha would suggest you file a bug at https://github.com/scalatra/scalatra/issues and accept the stackoverflow question so others that search for the same issue see an valid answered question. |
Thanks for closing this out. We have a bug filed against scalatra: scalatra/scalatra#575 |
@jamesatha Also you might want to look at how jetty servers files from DefaultServlet. The most efficient way to server a large file is to use a file mapped buffer and an asynchronous write. This will write the file with minimum copying (perhaps none) and no thread waiting for it it complete. |
We have an endpoint serving static files. It seems to work fine for files less than 2GB. But larger ones seem to get truncated at Integer.MAX_VALUE bytes. If you curl or wget these endpoints, it seems to download the truncated file with no errors
We have a different endpoint that sends data that it's holding in an BufferedInputStream. When the stream is greater than Integer.MAX_VALUE, the clients get the first Integer.MAX_VALUE and hang waiting for more data
The text was updated successfully, but these errors were encountered: