我有一个 CPU 利用率几乎达到极限的 Linux 机器。我曾经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
向我展示 tid 和 nid?