1) Thread Dump overview & fundamentals
2) Thread Dump generation techniques and available tools
3) Thread Dump format -Sun Hotspot
4) Thread Stack Trace explanation and interpretation
5) Thread Dump analysis and correlation techniques
6) Thread Dump common problem patterns
- Thread race,
- deadlock,
- hanging IO calls,
- garbage collection / OutOfMemoryError problems,
- infinite looping etc.
7) Thread Dump examples via real life case studies
看Java StackTrace的各种方法:
1. JPS 获取 PID –> jstack <optional>PID.
-F to force a thread dump. Use when jstack <pid> does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
2. Visual VM
如果profiling remote jvm,需要在jvm configure里面加
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/jmx_connections.html
3. Btrace, 自带Sample里面的代码
@BTrace
public class JStack {
static {
deadlocks(false);
jstackAll();
exit(0);
}
}