Grails: Tomcat won't shut down cleanly in prod

帅比萌擦擦* 提交于 2019-12-04 10:13:54
Kerem Baydoğan

Non-Daemon Threads

Probably one or more non-daemon thread is still running and preventing tomcat from a successful shutdown.

  • open Terminal and type ps -ef| grep java and find your Tomcat7 p_id
  • type kill -3 p_id
  • type (in your Tomcat directory) tail -200 logs/catalina.out
  • inspect thread dump generated by the kill -3
  • look for non-daemon threads
  • inspect your code to determine why that process is still alive.
Derek Slife

I agree with Kerem Baydoğan. There's likely a non-daemon thread which doesn't want to stop. A thread dump is a great way to track this down.

I would recommend connecting to your remote JVM using VisualVM. This has been an invaluable tool for me to gather information about my running applications. If you're on a Mac, it's installed as part of the OS already. From a terminal, just type 'jvisualvm'. If not on a Mac, it's a free download from http://visualvm.java.net/

Once installed, you may need to add a few JVM args to allow the remote connection. http://visualvm.java.net/jmx_connections.html

Screenshot:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!