I'm running a Tomcat 8.5 and each time I shutdown the tomcat via the control scripts, it dumps it's threads:
Full thread dump OpenJDK 64-Bit Server VM (25.232-b09 mixed mode):
"Framework stop" #101 daemon prio=5 os_prio=0 tid=0x00007fb540004800 nid=0x1a05 runnable [0x00007fa8a10ed000]
java.lang.Thread.State: RUNNABLE
...
JNI global references: 1348
Heap
garbage-first heap total 13041664K, used 3910741K [0x00007fb5e7800000, 0x00007fb5e80031c0, 0x00007fbe2c000000)
region size 8192K, 1 young (8192K), 0 survivors (0K)
Metaspace used 94108K, capacity 99079K, committed 99244K, reserved 100352K
After that it takes ~2 minutes to get to the next log message:
INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
It seems that the dumping of all threads takes quite a while, which I really don't need during a regular shutdown.
We are utilizing OpenJDK 11 on EC2 Linux instance.
The control script is utilizing the catalina.sh
which itself seems to use the shutdown port.
catalina.sh stop
is the command issued by the scripts.
The same behavior happens when I execute kill -3
on the Tomcat instance.
kill -15
does not show this behavior.
Is there a possibility to deactivate this behavior, either in the Tomcat configuration or the JVM parameters?
Apparently, the thread dump is not a reason, but a consequence of the fact that the application does not shutdown in time.
catalina.sh
purposely makes a thread dump when stop operation takes long. This is exactly for investigation of shutdown issues. I'd suggest to look into the thread dump instead of trying to avoid it.