Hello, I am having an issue with Tomcat shutdown. Requests arriving while the servlet container is shutting down seem to be held up by the connector until container shutdown finishes. The shutdown sequence appears to be: (1) pause connectors, (2) stop containers, (3) stop connectors. I have noticed via JMX that Connector.pause() accepts connections and holds them indefinitely - which I think is the case here.
The problem is, our servlet can take up to a minute to shut down, meaning connections arriving during this period are held for up to a minute. Is this behavior correct/expected? We have an nginx load balancer in front of our Tomcat servers that re-routes connections upon error (refused, reset, etc.). But this doesn't work well during server restarts since requests are held for many seconds before being re-routed. The result is a flood of slow responses when a server shuts down. Wouldn't ideal Tomcat shutdown behavior be to (1) let existing requests finish (as it already does), but (2) reject new connections (instead of accepting and holding them)? Tested with: Tomcat 7.0.23 and 7.0.53 NIO connector JDK 1.7.0_07 (Windows) and 1.7.0_17 (Linux) Thanks in advance.