tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: Should I increase connectionUploadTimeout value
Date Wed, 28 Dec 2016 10:51:45 GMT
Hi.

On 28.12.2016 10:14, Yuval Schwartz wrote:
> Tomcat: 8.0.22
> Java: jdk1.8.0_05
> Server: Amazon Linux
>
> Hello,
>
> I recently saw an IOFileUploadException on my server:
>
> org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException:
> Processing of multipart/form-data request failed. Timeout attempting to
> read dat
> a from the socket
>
> And later, I get this exception:
> org.apache.tomcat.util.http.fileupload.MultipartStream$MalformedStreamException:
> Stream ended unexpectedly
>
> I allow images to be uploaded in a multipart form.
>
> I don't allow uploads greater than 1 MB.
>
> Presently, my connector element is set up with only a connectionTimeout
> attribute (set at 20 seconds) and without a connectionUploadTimeout
> attribute.
>
> I was wondering if it's necessary to set up a connectionUploadTimeout time
> greater than 20 seconds for such small file uploads? Or is it something
> else that caused this timeout?
>

1) specifically : such a timeout could occur "naturally" if the connection of the client 
to the server is interrupted, for whatever reason. You did not mention what the client is

seeing in that case, you only described what you see in the log from the server side.
(That's ok, you probably don't know anyway).
Maybe the client (the person at the uploading form side) decided to interrupt the upload,

by navigating to some other page. If there are other "devices" in-between (routers, 
firewalls, proxies,..) (as there most probably are, nowadays) they may maintain their 
connection to the server for a while, even if the original client has gone.  Tomcat would

thus not see the broken connection immediately, it would still be waiting for more data to

arrive on the connection, until this timeout kicks in.
Increasing the timeout in this case, would just mean that you are blocking a tomcat 
resource for a while longer, for no real good reason since the client is already gone.

In short, my opinion : if you only see this once in a while in your logs, I would not 
worry about it. It would be different if your "clients" started complaining about having 
their uploads interrupted regularly. But then you could ask them for exactly what they are

seeing in the browser as an error, and at exactly what time; and then you could have 
another look at the log for that timestamp, to see if it is the same case as above.


2) generally : I must say that it is not very clear in the on-line documentation, at
https://tomcat.apache.org/tomcat-8.5-doc/config/http.html#Standard_Implementation
-> Standard Implementation -> connectionUploadTimeout
(and also in the similar 7.0 docs)
what exactly this timeout applies to. Is it
- the timeout before the client actually *starts* sending *any* request body data for this

upload ?
- or a timeout which applies at any time tomcat is trying to read *some* (a chunk of) data

for this part of the multipart/form-data post, after already reading some data ?
Similarly for the "disableUploadTimeout" attribute.
I believe that the confusion may have to do with the usage of the term "data upload" 
there.  It seems that, maybe, using "request body" may have been more appropriate throughout.
(Because in a way, any HTTP POST is a "data upload", even when it is not a 
multipart/form-data and/or not a file).



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


Mime
View raw message