Thanks for replying Konstantin. See my responses to your questions below.
--
np



--
Tradar Limited  is a limited company registered in England and Wales. 
Registered number: 3431380.
Registered office: 20-21 Jockey's Fields, London. WC1R 4BW

-----Original Message-----
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
Sent: 10 April 2012 13:39
To: Tomcat Users List
Subject: Re: Problems uploading huge files >2GB to Tomcat app.

2012/4/10 Nick Porter <nick.por...@tradar.com>:
>
> Hi all. New to Tomcat and not a developer but I have been trying to deploy a 
> website using Debian6, Tomcat 6.0.35 hosting the OpenCMS 8.0.1 app. The 
> website and the OpenCMS app has a facility to upload files however I only 
> seem to be able to upload files that are less than 2GB. I did read that there 
> used to be a 2GB bug in Tomcat a few versions ago but that this had since 
> been resolved.
>
> The errors I am seeing are a mixture of  400 Bad Request and 413 Request 
> Entity too Large.
>
> I'm connecting directly to Tomcat and the app/site on the HTTP/1.1 connector, 
> port 8080.
>
> I could be wrong but I can't see anything untoward in the logs located
> at /var/log/tomcat6/
>
> The chaps over at the OpenCMS mail list assure me that OpenCMS is capable of 
> handling files of this size so I'm guessing my Tomcat config is in some way 
> causing the problem.
>
> I've expanded the memory for the heap in the /etc/defaults/tomcat6
> file with;
>
> JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -XX:+UseConcMarkSweepGC"
>
> ...and added the maxPostSize="0" to the HTTP connector but I'm still see 
> these errors.
>
> Here's my connector settings from server.xml
>
>    <Connector port="8080" protocol="HTTP/1.1"
>               connectionTimeout="20000"
>               URIEncoding="UTF-8"
>               maxPostSize="0"
>               redirectPort="8443" />
>
> The only other settings I found relating to the size of a POST were the 
> packetSize attribute but believe this is only relevant to the AJP connector.
>
> I'm at a loss as to what to try next so have come here as a last resort. Can 
> anybody give me any pointers or advice on how I can further investigate and 
> resolve this problem?
>

1. Tomcat 6 does not handle file upload by itself (if you are using 
Content-Type="multipart/form-data"). It can only provide
request.getInputStream() and something else has to consume it.

Usually that will be Apache Commons Fileupload library, but you will have to 
check what OpenMS uses.

[NP] I'm pretty sure OpenCMS is handling it. I don't have Apache installed in 
my test rig and can upload smaller files.

I do not remember what default configuration of Fileupload library is.
Certainly such big files have to go into a temporary folder, but I do not 
remember whether it is configured by default.  Tomcat startup script sets 
java.io.tmpdir property to point to "$CATALINA_BASE/temp".

Are you able to upload big files that are more than 512Mb, but less than 2Gb?

[NP] Yes. I've been able to upload a 1.9ish GB file but anything over 2GB and 
it fails.

The file upload form - does it come from OpenCMS?

[NP] Yes.

2. It is possible to configure "connectionUploadTimeout" and 
"disableUploadTimeout" on a Connector. I cannot say for sure how much relevant 
are they  to those 400 and 413 errors.

[NP] I've tried these but they had no effect.

Do 400 vs 413 errors change randomly?

[NP] Yes. I can fathom no pattern to them. In fact, the only way I can actually 
see them is to packet trace the HTTP exchange.

3. If FORM authentication is used, it usually saves request before displaying 
the login form.  This request is saved in memory and its size is very limited 
(several Kb).

If your session expires when you submit your file I think you will see an error 
because of that limit.

[NP] Don't think this is it. Not seeing any login issues.

4. If file size is >2Gb then the method
"response.setContentLength(int)" cannot be used. One has to use 
response.setHeader("Content-Length", Long.toString(length));  That is the only 
thing in API that I remember that is relevant to handling files > 2Gb.

[NP] Can't say on this one.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to