How to get Jetty thread dump?

坚强是说给别人听的谎言 提交于 2019-12-10 05:53:22

问题


I have a Ubuntu Server 10.10 64-bit running a web application on Jetty 6.1.24-6 on Sun's JVM, both installed from standard Ubuntu repositories.

I'm trying to track down a problem with this server (100% cpu after some time, it might be related to a known bug on NIO's Selector, although it looks like changing the connector to old io SocketConnector didn't solve the problem!), and need to take a thread dump.

Unfortunately I'm unable to get the thread dump. I've tried to send a SIGQUIT to the process, and tried to attach JStack to it, but neither approach works.

I see no output at all from SIGQUIT (in any of the log files generated by Jetty), and JStack, even when run as root (or jetty) and with "-F", says that it has been attached to the process, but then blocks and produces no more output!

How can I obtain the thread dump?


回答1:


You have to do this as the same user as the jetty process is running under. On Ubuntu this user is normally called jetty.

So try

sudo -u jetty jstack <pid>

this will send a thread dump to stdout (your shell).

You can also

sudo -u jetty kill -QUIT <pid>

which will send the thread dump to jetty's stdout (normally /var/log/jetty/out.log)

To get the pids use the jps command or ps ax|grep java




回答2:


did you try VisualVM (/usr/lib/java-6-sun/bin/jvisualvm) with remote connection ? It can capture a thread dump



来源:https://stackoverflow.com/questions/6061302/how-to-get-jetty-thread-dump

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