如何分析 jvm的崩溃日志
jvm在崩溃的情况下,会生成一个 hs_err_pidxxx.log的文件,这个文件一般生成在java进程的启动目录里。
那么如何分析这个日志呢?
- 首先打开文件看到的就是 报错内容概览
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000fffe81979914, pid=17399, tid=0x0000fffe6d7d01e0
#
# JRE version: OpenJDK Runtime Environment (8.0_212-b01) (build 1.8.0_212-8u212-b01-1~deb9u1-b01)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b01 mixed mode linux-aarch64 compressed oops)
# Problematic frame:
# C [libsw3.so+0x66914] CCA_DibExecutor::DissectRect(CCA_Rect const*, int&, int&, int&, int&, int&, int&) const+0x54
#
# Core dump written. Default location: /root/TongWeb7.0/bin/core or core.17399
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
SIGSEGV (0xb) at pc=0x0000fffe81979914, pid=17399, tid=0x0000fffe6d7d01e0
这一行代码表示出错的进程id号:
SIGSEGV 错误的信号类型
pc 就是IP/PC寄存器值也就是执行指令的代码地址
pid 就是进程id
下面就是jdk的版本和jvm的信息
重点是——- Problematic frame:
它说明jvm 在Crash的时候,正在从哪个库文件执行代码。除了“V”以外,还有可能是“C”、“j”、“v”、“J”。具体的表示意思如下:
Frame类型描述:
C: Native C frame
j: Interpreted Java frame
V: VMframe
v: VMgenerated stub frame
J: Other frame types, including compiled Java frames
然后根据报错的内容去搜索日志文件,比如 ,我这次报错的是
C [libsw3.so+0x66914] ,那么去搜索 libsw3.so,便可以在日志中找到这样就可以直接判断出是哪个jar里的代码出现了问题。
2.