javalinuxjstack

Output from jstack missing tid and nid information


I have a Linux box with nearly maxed out CPU utilization. I used top to track down the offending Java process (12462) and underlying threads (12465 and 12466). I was hoping to run jstack and search in the output for 30b1 and 30b2 (the aforementioned threads converted to hex) so I could figure out what Java is doing.

When I ran jstack without any flags, it returned the following error:

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

However, when I ran jstack -F the output didn't contain tid or nid information. Here's an excerpt from the output:

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)

I ran jstack -F -l but the command seemed to lock up.

When I ran jstack -F -m, I was able to find the decimal threads but the output didn't contain enough of the actual Java stack for me to figure out what it's doing. Here's another portion of the output:

----------------- 12465 -----------------
0x0000003e54889dd0      _wordcopy_fwd_aligned + 0x140

What am I missing? How can I get jstack to show me the tid and nid?


Solution

  • When you use -F you cannot get the tid and nid.
    I believe that you are jstacking some pid which doesn't belong to you. Try to switch to the user who own the pid before executing jstack. Try the following command

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