tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: FileUploadBase$IOFileUploadException
Date Thu, 02 Sep 2010 19:58:33 GMT
Paul Szynol wrote:
> 
> Chris, I agree.  "Exceeds threshold size" or something along those lines 
> would be a lot more helpful.
> Paul
> 
I believe that you missed Konstantin's message, and that consequently you may have a false

sense of security and a false sense of having found the correct solution and a false sense

that the error message was inaccurate.

In http://commons.apache.org/fileupload/using.html, they show these settings :

// Set factory constraints
factory.setSizeThreshold(yourMaxMemorySize);
factory.setRepository(yourTempDirectory);

...

// Set overall request size constraint
upload.setSizeMax(yourMaxRequestSize);


 From this, and from your original message, I gather that the way it works is :

- FileUpload will first try to upload the whole request in memory (for performance).
But if the request size exceeds the value set by .setSizeThreshold() (or 1 MB by default),

it will instead create a temporary file on disk to store the request.
- when it starts doing this (writing to disk), it is going to create this temporary file 
in the directory indicated by .setRepository().  If this is not explicitly set, it will 
default to "/".

So what happened on your first iteration, was that when the size exceeded the default of 1

MB, it tried to create a temporary file in "/", and failed because Tomcat does not have 
permission to write there.  From there came the (accurate) error message.
Now that you have increased the .setSizeThreshold() size, it does not reach it anymore, so

it does not create a temporary file, so you do not see the message anymore.
But it is a false solution, because now you have potentially  very large files being 
loaded in memory, and when that limit will some day be exceeded, you will get the 
permissions message again.


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


Mime
View raw message