If I setup tomcat and stream a static file from it, I've noticed that if the client "pauses" (stops receiving) from that socket for anything > 20s then tomcat appears to sever the connection arbitrarily (even though the request URI headers have been received and the connection is still "connected" [client is still alive]). What configuration parameter controls this? The documentation mentions connectionTimeout
but only in relation to initial header parsing and reading the request body, not reading the server's response [?] Is there some kind of inactivity timeout going on here?
It is reproducible, stream a (large) static file from any tomcat app, and receive it with a client that pauses, ex test.rb:
require "socket"
host = "localhost"
port = 8080
socket = TCPSocket.new host,port
url = "/your_webapp/large_static_filename.ext"
request = "GET #{url} HTTP/1.0\r\nHost:#{host}\r\n\r\n"
socket.print request
puts "reading"
response = socket.sysread 1_000_000
puts response.length
puts response[0..300]
puts "sleeping 25" # with 10s or several reads separated by 10s, it is OK
sleep 25
response2 = socket.read
# this should equal the total size, but doesn't...
puts "sum=#{response2.length + response.length}"
It works fine with other servers, so probably not some kind of OS limit at play. It's just vanilla Tomcat so no mod_jk or workers are at play...