jstack:目标进程没有响应 [英] jstack: Target process not responding
问题描述
我正在运行Ubuntu服务器版本,我想采用Tomcat的线程转储。
I am running Ubuntu server edition and I wanted to take a thread dump of Tomcat.
所以,我首先尝试找出哪个PID tomcat使用:
So, I first tried to find out which PID tomcat uses:
$ jps -l
5809 sun.tools.jps.Jps
但它不存在?
所以,我用 top
而不是找到PID 5730。
So, I used top
instead and found out the PID 5730.
然后我调用jstack来获取线程转储:
Then I called jstack to get the thread dump:
$ sudo jstack -l 5730
5730: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
发生了什么? : - (
What's going on? :-(
我已按照 Jstack和Jstat停止升级到JDK6u23 但这没有改变任何东西:
I already tried to export CATALINA_TMPDIR as described in Jstack and Jstat stopped working with upgrade to JDK6u23 but that didn't change anything:
$ export CATALINA_TMPDIR=/tmp
$ sudo /etc/init.d/tomcat6 restart
* Stopping Tomcat servlet engine tomcat6
...done.
* Starting Tomcat servlet engine tomcat6
...done.
$ sudo jstack -l 5934 // new PID after restart
5934: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
更新:
我也试过 sudo -u tomcat6 jstack -l -F 5730> threaddumpexceptions2.txt
但它只能在控制台上给我很多例外。
I also tried sudo -u tomcat6 jstack -l -F 5730 > threaddumpexceptions2.txt
but it only gives me tons of exceptions on the console.
推荐答案
我通过做两件事来实现它:
I got it working by doing two things:
- 将呼叫改为:
sudo -u tomcat6 jstack -J-d64 -m pid
- 用Sun的原始sun-6-jdk和sun-6-jre软件包替换OpenJDK
第1部分的说明:我切换到64位模式,使用 sudo
并以Tomcat用户身份运行该命令。
Explanation for part 1: I switched to 64-bit mode, used sudo
and run the command as Tomcat user.
注意:第2部分可能没有必要。对于一些用户来说,似乎第1部分就足够了。实际上,首先尝试添加 sudo
命令。它可能已经成功了。
Note: Part 2 might not be necessary. For some users it seems like part 1 is enough. In fact, try to add just the sudo
command first. It might already do the trick.
这篇关于jstack:目标进程没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!