Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stack trace of simple deadlock example using Jstack tool.
Github Link: https://github.com/cleantutorials/JConsole/blob/master/src/main/java/com/cleantutorials/jconsole/thread/DeadlockExample.java
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.221-b11 mixed mode):
"DestroyJavaVM" #13 prio=5 os_prio=0 tid=0x0000000002402800 nid=0x31a8 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Thread-1" #12 prio=5 os_prio=0 tid=0x000000001d841800 nid=0x7ef4 waiting for monitor entry [0x000000001f5af000]
java.lang.Thread.State: BLOCKED (on object monitor)
at com.cleantutorials.jconsole.thread.DeadlockExample$2.run(DeadlockExample.java:40)
- waiting to lock <0x000000076bbe9648> (a java.lang.Object)
- locked <0x000000076bbe9658> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)
"Thread-0" #11 prio=5 os_prio=0 tid=0x000000001d83f000 nid=0x7d24 waiting for monitor entry [0x000000001f4af000]
java.lang.Thread.State: BLOCKED (on object monitor)
at com.cleantutorials.jconsole.thread.DeadlockExample$1.run(DeadlockExample.java:24)
- waiting to lock <0x000000076bbe9658> (a java.lang.Object)
- locked <0x000000076bbe9648> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)
"Service Thread" #10 daemon prio=9 os_prio=0 tid=0x000000001d7d0800 nid=0x69f0 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread3" #9 daemon prio=9 os_prio=2 tid=0x000000001d74a000 nid=0x72c4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x000000001d749000 nid=0x6248 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x000000001d735800 nid=0x71c4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000001d733000 nid=0xab4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x000000001d72e000 nid=0x7450 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x000000001d738000 nid=0x6f34 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000001d723000 nid=0x1448 in Object.wait() [0x000000001eaae000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076bb88ed8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x000000076bb88ed8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x000000001c04d000 nid=0x7b20 in Object.wait() [0x000000001e9af000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076bb86c00> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Unknown Source)
at java.lang.ref.Reference.tryHandlePending(Unknown Source)
- locked <0x000000076bb86c00> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
"VM Thread" os_prio=2 tid=0x000000001c046800 nid=0x7c48 runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000002418000 nid=0x2b8c runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x0000000002419800 nid=0xd00 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000241b000 nid=0x5a04 runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x000000000241e800 nid=0x2b58 runnable
"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x000000000241f800 nid=0x1758 runnable
"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x0000000002421000 nid=0x3fb0 runnable
"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x0000000002424000 nid=0x6274 runnable
"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x0000000002425000 nid=0x1bdc runnable
"GC task thread#8 (ParallelGC)" os_prio=0 tid=0x0000000002426800 nid=0x3040 runnable
"GC task thread#9 (ParallelGC)" os_prio=0 tid=0x0000000002427800 nid=0x6220 runnable
"VM Periodic Task Thread" os_prio=2 tid=0x000000001d7ec800 nid=0x4bf0 waiting on condition
JNI global references: 4
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x000000001c052028 (object 0x000000076bbe9648, a java.lang.Object),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x000000001c0534c8 (object 0x000000076bbe9658, a java.lang.Object),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at com.cleantutorials.jconsole.thread.DeadlockExample$2.run(DeadlockExample.java:40)
- waiting to lock <0x000000076bbe9648> (a java.lang.Object)
- locked <0x000000076bbe9658> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)
"Thread-0":
at com.cleantutorials.jconsole.thread.DeadlockExample$1.run(DeadlockExample.java:24)
- waiting to lock <0x000000076bbe9658> (a java.lang.Object)
- locked <0x000000076bbe9648> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)
Found 1 deadlock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment