[Java] 纯文本查看 复制代码
Full thread dump Java HotSpot(TM) Client VM (25.131-b11 mixed mode):
"DestroyJavaVM" #11 prio=5 os_prio=0 tid=0x051fe800 nid=0x1e0c waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Thread-1" #10 prio=5 os_prio=0 tid=0x18777800 nid=0x5664 waiting for monitor entry [0x18e0f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at hello.DeadLock.resource1(DeadLock.java:31)
- waiting to lock <0x07415a50> (a java.lang.String)
at hello.DeadLock.resource2(DeadLock.java:43)
- locked <0x0742bd18> (a java.lang.String)
at hello.DeadLock.lambda$main$1(DeadLock.java:20)
at hello.DeadLock$$Lambda$2/4983748.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
"Thread-0" #9 prio=5 os_prio=0 tid=0x18776c00 nid=0x4dc4 waiting for monitor entry [0x18d7f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at hello.DeadLock.resource2(DeadLock.java:41)
- waiting to lock <0x0742bd18> (a java.lang.String)
at hello.DeadLock.resource1(DeadLock.java:33)
- locked <0x07415a50> (a java.lang.String)
at hello.DeadLock.lambda$main$0(DeadLock.java:11)
at hello.DeadLock$$Lambda$1/5592464.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
"Service Thread" #8 daemon prio=9 os_prio=0 tid=0x186e4c00 nid=0x172c runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread0" #7 daemon prio=9 os_prio=2 tid=0x186af000 nid=0x53f8 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Monitor Ctrl-Break" #6 daemon prio=5 os_prio=0 tid=0x1861e800 nid=0x3928 runnable [0x18b3f000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
- locked <0x07861da0> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
- locked <0x07861da0> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)
"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x179c0800 nid=0x40a0 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x17985c00 nid=0x5004 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x17972400 nid=0x41a8 in Object.wait() [0x17cff000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0ca1b830> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x0ca1b830> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x17960000 nid=0x4ef0 in Object.wait() [0x17c6f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0ca1b9d0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x0ca1b9d0> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"VM Thread" os_prio=2 tid=0x1795a800 nid=0x3f54 runnable
"VM Periodic Task Thread" os_prio=2 tid=0x18739400 nid=0x4a14 waiting on condition
JNI global references: 229
// 找到一个死锁
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x17978de4 (object 0x07415a50, a java.lang.String),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x1797a974 (object 0x0742bd18, a java.lang.String),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at hello.DeadLock.resource1(DeadLock.java:31)
// 等待 0x07415a50 锁
- waiting to lock <0x07415a50> (a java.lang.String)
at hello.DeadLock.resource2(DeadLock.java:43)
// 持有 0x0742bd18
- locked <0x0742bd18> (a java.lang.String)
at hello.DeadLock.lambda$main$1(DeadLock.java:20)
at hello.DeadLock$$Lambda$2/4983748.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
"Thread-0":
at hello.DeadLock.resource2(DeadLock.java:41)
// 等待 0x0742bd18 锁
- waiting to lock <0x0742bd18> (a java.lang.String)
at hello.DeadLock.resource1(DeadLock.java:33)
// 持有 0x07415a50
- locked <0x07415a50> (a java.lang.String)
at hello.DeadLock.lambda$main$0(DeadLock.java:11)
at hello.DeadLock$$Lambda$1/5592464.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
// 发现了一个死锁
Found 1 deadlock.