Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jstack to find blocker-thread

Tags:

java

jstack

using jstack i got an tree of threads running.

  1. What is the meaning of the folowing Thread.State's:

    • WAITING
    • TIMED_WAITING
    • RUNNABLE
  2. What means the tid and nid?

  3. The title of an Thread is like

    "Event Batch Processing (Spring UAA/1.0.2)" daemon prio=10 tid=0x0000000041e27800 nid=0x363b waiting on condition [0x00007f9a89267000]

    • How can i navigate to the Sourcecode-line of the "waiting-on-condition"-address
like image 490
Grim Avatar asked Nov 24 '11 10:11

Grim


1 Answers

  1. WAITING means that the thread is waiting on something. Typically you would see "WAITING (on object monitor)" that means it is waiting for a notify(). TIMED_WAITING is a variant of WAITING, where the thread has a max time limit to wait. RUNNABLE means that the thread is currently executing some code when the jstack was run.

  2. "tid" is the thread ID the thread have in the JVM (could be a memory address). "nid" is the native thread id (in hex). On some Linux systems this ID maps directly to a process ID (number 13883 (in decimal) in your case).

  3. I you are using Eclipse the plugin http://lockness.plugin.free.fr/ might be of interest. With this tool it is possible to quickly navigate to the source code and line.

like image 56
Lennart Schedin Avatar answered Oct 13 '22 11:10

Lennart Schedin