jstack(Stack Trace for Java)
用于查看java程序的java stack和native stack的信息。
命令格式
jstack [ options ] vmid
jstack [ options ] [server-id@]remote-hostname-or-IP
常用参数说明
-m 如果调用的是本地方可以显示C or C++的堆栈。
-l 显示堆栈和锁的附加信息,如ownable synchronizers列表
示例:1
"Thread-2" prio=6 tid=0x19ea1000 nid=0x4810 at breakpoint[0x1a25f000]
java.lang.Thread.State: RUNNABLE
at com.shunwang.meteor.example.ConditionExample$ProductQueue.put(ConditionExample.java:65)
at com.shunwang.meteor.example.ConditionExample$1.run(ConditionExample.java:19)
at java.lang.Thread.run(Thread.java:619)
Locked ownable synchronizers:
- None
"Thread-1" prio=6 tid=0x025ef800 nid=0x3ec0 at breakpoint[0x1a1cf000]
java.lang.Thread.State: RUNNABLE
at com.shunwang.meteor.example.ConditionExample$ProductQueue.put(ConditionExample.java:65)
at com.shunwang.meteor.example.ConditionExample$1.run(ConditionExample.java:19)
at java.lang.Thread.run(Thread.java:619)
Locked ownable synchronizers:
- None
"Thread-0" prio=6 tid=0x025ef000 nid=0x671c runnable [0x1a13f000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
- locked <0x09b43270> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(PrintStream.java:432)
- locked <0x09b40898> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85)
- locked <0x09b432b0> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168)
at java.io.PrintStream.newLine(PrintStream.java:496)
- locked <0x09b40898> (a java.io.PrintStream)
at java.io.PrintStream.println(PrintStream.java:687)
- locked <0x09b40898> (a java.io.PrintStream)
at com.shunwang.meteor.example.ConditionExample$ProductQueue.put(ConditionExample.java:82)
at com.shunwang.meteor.example.ConditionExample$1.run(ConditionExample.java:19)
at java.lang.Thread.run(Thread.java:619)
Locked ownable synchronizers:
- <0x09b43328> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
"Low Memory Detector" daemon prio=6 tid=0x025e6c00 nid=0xafa8 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None