我有一个Linux盒,CPU利用率几乎达到极限。我使用top来跟踪有问题的Java进程(12462)和基础线程(12465和12466)。我希望运行jstack并在输出中搜索30b1和30b2(上述线程转换为十六进制),以便弄清楚Java在做什么。

当我运行不带任何标志的jstack时,它返回以下错误:

12462: 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

但是,当我运行jstack -F时,输出不包含tid或nid信息。这是输出的摘录:
Thread 31374: (state = IN_NATIVE)
 - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise)
 - java.net.SocketInputStream.read(byte[], int, int, int) @bci=79, line=150 (Compiled frame)
 - java.net.SocketInputStream.read(byte[], int, int) @bci=11, line=121 (Compiled frame)
 - org.apache.coyote.http11.InternalInputBuffer.fill(boolean) @bci=59, line=516 (Compiled frame)
 - org.apache.coyote.http11.InternalInputBuffer.fill() @bci=2, line=501 (Compiled frame)
 - org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout() @bci=90, line=173 (Compiled frame)
 - org.apache.coyote.http11.AbstractHttp11Processor.process(org.apache.tomcat.util.net.SocketWrapper) @bci=156, line=925 (Compiled frame)
 - org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(org.apache.tomcat.util.net.SocketWrapper, org.apache.tomcat.util.net.SocketStatus) @bci=149, line=585 (Compiled frame)
 - org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run() @bci=130, line=312 (Compiled frame)
 - java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=95, line=1145 (Compiled frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=615 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)

我运行了jstack -F -l,但命令似乎已锁定。

当我运行jstack -F -m时,我能够找到十进制线程,但是输出中包含的实际Java堆栈不足以让我弄清楚它在做什么。这是输出的另一部分:
----------------- 12465 -----------------
0x0000003e54889dd0      _wordcopy_fwd_aligned + 0x140

我想念什么?我如何获得jstack向我展示潮汐和潮汐?

最佳答案

当您使用-F时,您将无法获得tid和nid。
我相信您正在堆叠不属于您的pid。执行jstack之前,尝试切换到拥有pid的用户。尝试以下命令

sudo -u {user who own the process} jstack -l pid

关于java - jstack的输出缺少tid和nid信息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26068370/

10-08 21:31