[GRIZZLY-811] Problem Uploading Files over 2GB Created: 08/Apr/10  Updated: 08/Apr/13  Resolved: 08/Apr/13

Status: Resolved
Project: grizzly
Component/s: all
Affects Version/s: 1.9.9
Fix Version/s: 1.9.40

Type: Bug Priority: Major
Reporter: makoto1337 Assignee: oleksiys
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: All
Platform: Macintosh

Issuezilla Id: 811


When uploading files over 2 Gb, I get the following exception:

at com.sun.grizzly.util.buf.Ascii.parseLong(Ascii.java:232)
at com.sun.grizzly.util.buf.ByteChunk.getLong(ByteChunk.java:542)
at com.sun.grizzly.util.buf.MessageBytes.getLong(MessageBytes.java:712)
at com.sun.grizzly.tcp.Request.getContentLengthLong(Request.java:367)
at com.sun.grizzly.http.ProcessorTask.prepareRequest(ProcessorTask.java:1350)
at com.sun.grizzly.http.ProcessorTask.parseRequest(ProcessorTask.java:867)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:659)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)


It looks like somewhere the file size in bytes is not being kept as a long, since ints cannot store the
bytesize for files over 2Gb. Can this be fixed in Grizzly? 2Gb is not such a big file size.

I am using GlassFish v3 and the grizzly installed is the glassfish-grizzly that was released with it.
Version 1.9.18-9.

Comment by oleksiys [ 09/Apr/10 ]

it shouldn't be related to file size.
Can you pls. make a dump of HTTP request header?

Comment by makoto1337 [ 09/Apr/10 ]

I should mention that files just under 2Gb work fine, but files 2Gb and over fail.

I will be away next week, but after that I will try to copy the HTTP request header for you. Can you upload
files over 2Gb using Grizzly?

Comment by oleksiys [ 09/Apr/10 ]

I've tried to telnet to a port and pass big content-length header and checked that it was parsed correctly.
Can you pls. do the same check?

Comment by Justin Lee [ 03/Jan/11 ]

consolidating to one user name

Comment by babbarkrishan [ 09/Mar/11 ]


Its actually glassfish settings for max size of post data.
To check, go to admin panel (http://localhost:4848/)
click on Network Config->Network Listeners->http-listener-1 or http-listener-2.

Then click on HTTP tab above.
Here see the value of Max Post Size. It is the max size which can be sent in post.
Here it is taking integer values which can be maximum 2147483647 (1 less than 2 GB (2147483648 bytes)).
Which is the reason we can not upload more than 2 GB data.

I am also trying to make a site which can handle large file uploads and can handle multiple requests concurrently. So far I am not clear how and where grizzly comes in role? What all settings I need to do? How can we test if grizzly is being used and its beneficial?

I also tried to make a standalone webserver using Grizzly, but i am unable to parse file being uploaded within my HttpHandler.

Please help me to understand grizzly and share some code for saving uploaded files in grizzly.

Krishan Babbar

Generated at Tue Dec 01 17:23:34 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.