If AjpAprProtocol as JWS3 on RHEL7 default is used, the idle connection is not closed until twice as keepAliveTimeout has elapsed.
With the below connector settings, idle connections that are 10 seconds elapsed are expected to be closed, but it actually takes 20 seconds to be closed.
<Connector port="8009" protocol="org.apache.coyote.ajp.AjpAprProtocol " redirectPort="8443" connectionTimeout="10000" keepAliveTimeout="10000"/>
This issue occurs every time and is reproducible. When this issue is reproduced, the following log appears in the console:
// Response end: 20:19:17 05-Feb-2021 20:19:17.545 FINE [ajp-apr-8009-Acceptor-0] org.apache.tomcat.util.net.AprEndpoint.processSocketWithOptions socket [139,851,114,483,296] // When the keepAliveTimeout time elapses, the following log will appear, the idle connection is still not closed at this point. 05-Feb-2021 20:19:27.640 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.run Add to poller socket [139,851,114,483,296] 05-Feb-2021 20:19:27.641 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller // After 10 seconds, the following log will appear and the idle connection is closed at this point 05-Feb-2021 20:19:37.647 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.maintain Timing out [139,851,114,483,296] 05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Attempting to remove [139,851,114,483,296] from poller 05-Feb-2021 20:19:37.648 FINE [ajp-apr-8009-Poller] org.apache.tomcat.util.net.AprEndpoint$Poller.removeFromPoller Removed [139,851,114,483,296] from poller