You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Pentzlin, David" <Da...@commscope.com> on 2015/10/29 08:53:49 UTC

Apache Tomcat will close connection on slow file download with non blocking http protocol

Per default the protocol in server.xml is configured as protocol="HTTP/1.1". with newer tomcat versions this will use a non blocking protocol if possible.

Problem:
Setup Tomcat (8.0.28) with default settings. Copy a file in a webapp e.g. webapps/root and download the file with limited speed to simulate a slow modem download.
wget http://xxx.xxx.xxx.xxx:8080/xxxxxxx/7.zip --limit-rate=1k
Connection will be closed always after 6minutes and 24seconds
Saving to: '7.zip'
7.zip               0%[                      ] 767.99K  1.00KB/s   in 6m 24s
2015-10-28 17:27:39 (1024 B/s) - Connection closed at byte 786426. Retrying.

if i change the protocol to (blocking):
  protocol="org.apache.coyote.http11.Http11Protocol"
everything is fine and the download will complete with slow speed.
If the change the speed (default HTTP/1.1) the time after the connection is closed is different (e.g. for 7kb/sec it will always close after 3minutes and 21sec). If the speed is 8kb/sec or higher the download seems to be stable with both protocols.
What could be the issue?

Best Regards


Re: Apache Tomcat will close connection on slow file download with non blocking http protocol

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Pentzlin,

On 10/29/15 8:41 AM, Mark Thomas wrote:
> On 29/10/2015 07:53, Pentzlin, David wrote:
>> Per default the protocol in server.xml is configured as protocol="HTTP/1.1". with newer tomcat versions this will use a non blocking protocol if possible.
>>
>> Problem:
>> Setup Tomcat (8.0.28) with default settings. Copy a file in a webapp e.g. webapps/root and download the file with limited speed to simulate a slow modem download.
>> wget http://xxx.xxx.xxx.xxx:8080/xxxxxxx/7.zip --limit-rate=1k
>> Connection will be closed always after 6minutes and 24seconds
>> Saving to: '7.zip'
>> 7.zip               0%[                      ] 767.99K  1.00KB/s   in 6m 24s
>> 2015-10-28 17:27:39 (1024 B/s) - Connection closed at byte 786426. Retrying.
>>
>> if i change the protocol to (blocking):
>>   protocol="org.apache.coyote.http11.Http11Protocol"
>> everything is fine and the download will complete with slow speed.
>> If the change the speed (default HTTP/1.1) the time after the connection is closed is different (e.g. for 7kb/sec it will always close after 3minutes and 21sec). If the speed is 8kb/sec or higher the download seems to be stable with both protocols.
>> What could be the issue?
> 
> It depends a lot on how the rate limiting is implemented, what is
> buffered where and when stuff times out.
> 
> That said, I'd expect the behaviour to be consistent between the
> different connector implementations. Timeouts is one of those areas
> where differences have crept in. Please open a Bugzilla issue for this
> so it doesn't get lost and someone will take a look.

Great test-case, by the way:

1. Starts with "Install a stock Tomcat x.y.z, then modify it in this way"
2. Includes repeatable objective criteria to test, using
easily-available tools
3. Demonstrates the failure (I haven't replicated it myself, but given
the quality of the post, I suspect it will be trivially reproducible)

This is much better than the "Tomcat crashed when I ran my home-spun
client against it what is wrong please help me super rushed deadline
here" reports we get sometimes.

Well done.

-chris

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


Re: Apache Tomcat will close connection on slow file download with non blocking http protocol

Posted by Mark Thomas <ma...@apache.org>.
On 29/10/2015 07:53, Pentzlin, David wrote:
> Per default the protocol in server.xml is configured as protocol="HTTP/1.1". with newer tomcat versions this will use a non blocking protocol if possible.
> 
> Problem:
> Setup Tomcat (8.0.28) with default settings. Copy a file in a webapp e.g. webapps/root and download the file with limited speed to simulate a slow modem download.
> wget http://xxx.xxx.xxx.xxx:8080/xxxxxxx/7.zip --limit-rate=1k
> Connection will be closed always after 6minutes and 24seconds
> Saving to: '7.zip'
> 7.zip               0%[                      ] 767.99K  1.00KB/s   in 6m 24s
> 2015-10-28 17:27:39 (1024 B/s) - Connection closed at byte 786426. Retrying.
> 
> if i change the protocol to (blocking):
>   protocol="org.apache.coyote.http11.Http11Protocol"
> everything is fine and the download will complete with slow speed.
> If the change the speed (default HTTP/1.1) the time after the connection is closed is different (e.g. for 7kb/sec it will always close after 3minutes and 21sec). If the speed is 8kb/sec or higher the download seems to be stable with both protocols.
> What could be the issue?

It depends a lot on how the rate limiting is implemented, what is
buffered where and when stuff times out.

That said, I'd expect the behaviour to be consistent between the
different connector implementations. Timeouts is one of those areas
where differences have crept in. Please open a Bugzilla issue for this
so it doesn't get lost and someone will take a look.

Thanks,

Mark


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