简体   繁体   English

如何避免关闭时完全线程转储?

[英]How to avoid full thread dump on shutdown?

I'm running a Tomcat 8.5 and each time I shutdown the tomcat via the control scripts, it dumps it's threads:我正在运行 Tomcat 8.5,每次我通过控制脚本关闭 tomcat 时,它都会转储它的线程:

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:之后,大约需要 2 分钟才能到达下一条日志消息:

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.我们在 EC2 Linux 实例上使用 OpenJDK 11。 The control script is utilizing the catalina.sh which itself seems to use the shutdown port.控制脚本正在使用catalina.sh ,它本身似乎使用了关闭端口。

catalina.sh stop is the command issued by the scripts. catalina.sh stop是脚本发出的命令。

The same behavior happens when I execute kill -3 on the Tomcat instance.当我在 Tomcat 实例上执行kill -3时,也会发生相同的行为。 kill -15 does not show this behavior. kill -15不显示此行为。

Is there a possibility to deactivate this behavior, either in the Tomcat configuration or the JVM parameters?是否有可能在 Tomcat 配置或 JVM 参数中停用此行为?

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.当停止操作需要很长时间时, catalina.sh会故意进行线程转储 This is exactly for investigation of shutdown issues.这正是为了调查关机问题。 I'd suggest to look into the thread dump instead of trying to avoid it.我建议查看线程转储而不是试图避免它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM