Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-21 Thread M. Thiim
Hi Chris That is a good suggestion. But more importantly, maybe update the documentation of the bindOnInit parameter, since it's not very intuitive this has anything to do with graceful shutdown and I don't think any connection with keep-alive is mentioned. I'm also not sure why bindOnInit=false

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Christopher Schultz
Mark, On 11/18/22 10:38, Mark Thomas wrote: I've just found the comment I missed the first time. This has already been implemented. You need to set the following: Connector   bindOnInit="false" Service   gracefulStopAwaitMillis="2" This assumes you are using the default keep-alive tim

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread M. Thiim
Hi Mark, ahh missed that - I just tried, you are right, it seems to give exactly what we want... closing connections on next incoming request when possible and otherwise waiting for the shutdown to complete. Thanks a lot and have a nice weekend. - M Den fre. 18. nov. 2022 kl. 18.49 skrev Mark

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Mark Thomas
On 18/11/2022 17:40, M. Thiim wrote: Hi Mark, sorry I'm not sure what you mean by "read the rest of the thread"... My "I just tried this..." was in response to your suggestion of using the bindOnInit and gracefulStopAwaitMillis parameters. Thx! The behaviour you describe is consistent with bind

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread M. Thiim
Hi Mark, sorry I'm not sure what you mean by "read the rest of the thread"... My "I just tried this..." was in response to your suggestion of using the bindOnInit and gracefulStopAwaitMillis parameters. Thx! Den fre. 18. nov. 2022 kl. 18.35 skrev Mark Thomas : > Please read the rest of the thre

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Mark Thomas
Please read the rest of the thread. On 18/11/2022 17:24, M. Thiim wrote: Hi Mark, thanks, I just tried this. It does cause the server to insert a 20 second delay on shutdown and I get this message in the log: 18-Nov-2022 18:16:29.777 INFO [main] org.apache.coyote.AbstractProtocol.awaitConnecti

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread M. Thiim
Hi Mark, thanks, I just tried this. It does cause the server to insert a 20 second delay on shutdown and I get this message in the log: 18-Nov-2022 18:16:29.777 INFO [main] org.apache.coyote.AbstractProtocol.awaitConnectionsClose Waiting [20,000] milliseconds for existing connections to ["http-ni

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Mark Thomas
I've just found the comment I missed the first time. This has already been implemented. You need to set the following: Connector bindOnInit="false" Service gracefulStopAwaitMillis="2" This assumes you are using the default keep-alive timeout of 20s. If not, adjust gracefulStopAwaitMi

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Mark Thomas
PRs are always welcome. From the description provided, I think more use of the existing graceful shutdown could be made. I am also looking at whether a slightly broader refactoring is called for as there looks to be scope for better alignment between pause, stop and graceful stop. Mark On

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread M. Thiim
Hi Mark Great! I've actually made an experimental patch that fixes it, but it's perhaps not completely clean. To get the behavior the waiting needs to happen after the server has stopped accepting new connections, this seems to be the pause-phase. But the Http11Processoer rejects incoming requests

Re: Tomcat doesn't gracefully close keep-alive connections

2022-11-18 Thread Mark Thomas
On 17/11/2022 19:39, M. Thiim wrote: Hi, We have observed that Tomcat doesn't gracefully close keep-alive connections. Tomcat waits for already started requests to complete, but once those are done, Tomcat will close all connections immediately, irrespective of any configured keepAliveTimeout. T