Quick Troubleshooting Tips 快速排障 For Linux , OS X
Hung,DeadLocked,Looping Process 挂起,死锁,迭代
- 打印Java线程栈
jcmd 找到pid
kill -QUIT pid
jstack [-F] pid 打印所有线程 Dump
- 侦测死锁
jconsole 工具 Thread Tab 按钮 检测死锁
jstack -l pid
- Dump 可使用诊断工具,参考另一篇文章
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
- jdb Java Debug工具 注意需要权限 如果没使用过,可以先使用help了解一下
$:sudo jdb -connect sun.jvm.hotspot.jdi.SAPIDAttachingConnector:pid=pid
>:help
Troubleshoot System Crashes 系统崩溃排障
系统崩溃,异常终止,Java HotSpot VM,System Library,Java SE Library、API,Application Native Code,OS。。。;
定位 Locate
错误日志
[Error Log](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/felog.html#fatal_error_log_vm "Error Log")
确认 Determine Where the Crash Occurred
异常日志格式
# 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
分析
解决
报告
参考
- Quick Troubleshooting Tips on Solaris OS and Linux for Java SE 6
- Native Operating System Tools
- Find a Workaround