简体   繁体   中英

Apache Tomcat will close connection on 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 eg 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.

What could be the issue?

It is a known limitiation with the new apache protocols.

The only solution to have a stable connection below 64kb/sec is to change the settings: socket.txBufSize (smaller) and connection timeout (higher). for more details check: https://bz.apache.org/bugzilla/show_bug.cgi?id=58565

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM