如何避免关机时发生完整的线程转储? [英] How to avoid full thread dump on shutdown?

查看:80
本文介绍了如何避免关机时发生完整的线程转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Tomcat 8.5,每次通过控制脚本关闭tomcat时,它都会转储其线程:

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

此后,大约需要2分钟才能到达下一条日志消息:

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.

我们正在EC2 Linux实例上利用OpenJDK 11. 控制脚本使用的catalina.sh本身似乎在使用关机端口.

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是脚本发出的命令.

当我在Tomcat实例上执行kill -3时,也会发生相同的行为. kill -15没有显示此行为.

The same behavior happens when I execute kill -3 on the Tomcat instance. kill -15 does not show this behavior.

是否有可能在Tomcat配置或JVM参数中停用此行为?

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故意进行线程转储停止操作需要很长时间时.这恰好是为了研究关机问题.我建议研究一下线程转储,而不要避免它.

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.

这篇关于如何避免关机时发生完整的线程转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆