jcmd 找到pid kill -QUIT pid jstack [-F] pid 打印全部線程 Dump
jconsole 工具 Thread Tab 按鈕 檢測死鎖 jstack -l pid
jmap -dump:format=b,file= filename pid (with -F option if pid does not respond) 導出Dump jhat heap-dump-file 分析Dump jmap 其它命令 比較有用的 jmap -heap pid jmap -finalizerinfo pid
$:sudo jdb -connect sun.jvm.hotspot.jdi.SAPIDAttachingConnector:pid=pid >:help
系統崩潰,異常終止,Java HotSpot VM,System Library,Java SE Library、API,Application Native Code,OS。。。;html
錯誤日誌 [Error Log](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/felog.html#fatal_error_log_vm "Error Log")
異常日誌格式java
# SIGSEGV (0xb) at pc=0x417789d7, pid=21139, tid=1024 | | | | +--- thread id | | | +------------- process id | | +--------------------------- program counter | | (instruction pointer) | +--------------------------------------- signal number +---------------------------------------------- signal name
# Problematic frame: # C [libNativeSEGV.so+0x9d7] | +-- Same as pc, but represented as library name and offset. | For position-independent libraries (JVM and most shared | libraries), it is possible to inspect the instructions | that caused the crash without a debugger or core file | by using a disassembler to dump instructions near the | offset. +----------------- Frame type
Frame Type | Description |
---|---|
C | Native C frame |
j | Interpreted Java frame |
V | VM frame |
v | VM-generated stub frame |
J | Other frame types, including compiled Java frames |
Native Code Compiled Code HotSpot Compiler Thread 線程名CompilerThread VM Thread 線程名VMThread Stack Overflow 異常類型EXCEPTION_STACK_OVERFLOW _thread_in_native