如何获得Jetty线程转储? [英] How to get Jetty thread dump?

查看:114
本文介绍了如何获得Jetty线程转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Ubuntu Server 10.10 64位,它在 Sun的JVM 上的 Jetty 6.1.24-6 上运行了Web应用程序来自标准Ubuntu存储库.

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.

我正在尝试查找此服务器的问题(一段时间后100%cpu,这可能与NIO的Selector上的一个已知错误有关,尽管看起来好像将连接器更改为旧io SocketConnector并没有解决问题!),并且需要进行线程转储.

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.

不幸的是,我无法获取线程转储.我尝试向该过程发送 SIGQUIT ,并尝试将 JStack 附加到该过程,但是两种方法均无效.

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.

我从SIGQUIT(在Jetty生成的任何日志文件中)根本看不到任何输出,即使以root(或jetty)身份运行并带有"-F",JStack也表示它已附加到处理,但随后阻塞并不再产生输出!

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!

如何获取线程转储?

推荐答案

您必须以正在运行码头程序的同一用户身份执行此操作.在Ubuntu上,此用户通常称为jetty.

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

所以尝试

sudo -u jetty jstack <pid>

这会将线程转储发送到stdout(您的shell).

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

您也可以

sudo -u jetty kill -QUIT <pid>

这会将线程转储发送到码头的标准输出(通常为/var/log/jetty/out.log)

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

要获取pid,请使用jps命令或ps ax|grep java

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

这篇关于如何获得Jetty线程转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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