JVM 中jstack命令詳解
阿新 • • 發佈:2019-02-19
Java程式問題定位時執行緒棧資訊是一個重要線索,如下圖:
“Thread-1” prio=6 tid=0x05b84800 nid=0x660 waiting for monitor entry [0x063bf000] java.lang.Thread.State:Blocked (on object monitor) at com.road.threadDead.ThreadDead.run(ThreadDead.java:40) -waiting to lock<0x29617b0>(a java.lang.Object) -locked<0x29e617b8>(a java.lang.Object) at java.lang.Thread.run(Thread.java:724) Locked ownable synchronizers -None “Thread-0” prio=6 tid=0x05b84000 nid=0xfb8 waiting for monitor entry[0x0613f000] java lang.Thread.State:BLOCKED(on object monitor) at com.road.threadDead.ThreadDead.run(ThreadDead.java:29) -waiting to lock <0x29e617b8>(a java.lang.Object) -locked <0x29e617b0>( a java.lang.Object) at java.lang.Thread.run(Thread.java:724) Locked ownable synchronize -None
Thread-1:是執行緒名稱。
tid:Java的執行緒ID。
nid:每一個Java執行緒在作業系統層面都與一個執行緒對應,這個執行緒ID就是nid。
prio:執行緒優先順序。
waiting for monitor entry[0x063bf000]:等待獲取物件鎖,而這個物件正好由thread-0所持有,所以這兩個執行緒實際上是互鎖,也就是死鎖。
[0x063bf000]:執行緒棧起始地址。