4
我有一個Linux框,CPU利用率接近最大。我使用top
來追查有問題的Java進程(12462)和底層線程(12465和12466)。我希望運行jstack
並在輸出中搜索30b1和30b2(上述線程轉換爲十六進制),以便我能夠弄清楚Java正在做什麼。從jstack輸出缺少tid和nid信息
當我跑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?
是否有任何使用'-F'選項的理由? – Holger 2014-10-07 11:56:18
如果不使用'-F'選項,我無法讓'jstack'返回任何內容。我已經更新了一些信息。 – jstricker 2014-10-07 13:44:30
我很害怕這是'-F'選項的限制(至少在當前的實現中)。即使在像Windows這樣完全不同的體系結構上使用'-F -l',我也可以重現這種行爲,包括掛起。 – Holger 2014-10-07 14:21:37