https://bz.apache.org/bugzilla/show_bug.cgi?id=65137
--- Comment #2 from barm...@adobe.com --- Hi, Thanks for the answer. I use the Nio connector (and I can reproduce on tomcat 7 with the nio connector too). I can reproduce on tomcat 8.5 with the apr and the nio2 connector too. I did have time to investigate a little: it seems that the timeout detection in NioBlockingSelector.write() is quite unreliable. MBs of data will be written on the socket initially, after some point, the code may have to wait more than 20s to write 8192 bytes (default chunk size), we will get a timeout even if the socket has still its buffer quite full and data are still be sent What I have tried: 1 - increase the timeout. It works but the timeout is used for other things and it does not seem a very good idea to change it. 2 - reduce socket.txBufSize to 8191, it forces smaller writes in NioBlockingSelector.write(), time is updated more often, the timeout does not trigger. It seems to work correctly on debian 10 (openjdk 11). However: - this has no effect on openjdk 8 (debian 9; MBs of data are still accepted by the socket even if the SO_SNDBUF is under 8192bytes). - there is performance degradation (around 10% for 100MB reply). 3 - I have tried to tweak the code so that it wait a little more before writing data to the socket: keycount is initially set to 0 (instead of 1) I replaced the following code: if (cnt > 0) { time = System.currentTimeMillis(); //reset our timeout timer continue; //we successfully wrote, try again without a selector } by if (cnt > 0) { if (!buf.hasRemaining()) break; time = System.currentTimeMillis(); //reset our timeout timer } (the continue has been removed) The behavior is quite the same as 2/: it works on openjdk11 but not on openjdk8. I did not test the perf (I would bet it is less than 10%). Regards. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org