$ cat /proc/sys/kernel/core_pattern /var/tmp/cores/%e-%p-%u.core $ ls /var/tmp/cores java-21178-146385.core
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# # A fatal error has been detected by the Java Runtime Environment: # # SIGBUS (0x7) at pc=0x00007fde40016a32, pid=7808, tid=0x00007fde4075b700 # # JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libzip.so+0x11a32] newEntry+0x62 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # 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. #
hs_err_pid[pid].log
java应用崩溃日志中可以看到hs_err-pid[pid].log文件位置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00000000000010c6, pid=2446, tid=140570273433344 # # JRE version: Java(TM) SE Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 compressed oops) # Problematic frame: # C 0x00000000000010c6 # # Core dump written. Default location: /home/ewallet/quhua/quhua-online/default/tomcat/core or core.2446 # # An error report file with more information is saved as: # /home/default/tomcat/hs_err_pid2446.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp #
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x0000003797807a91, pid=29071, tid=139901421901568 # # JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libresolv.so.2+0x7a91] __libc_res_nquery+0x1c1 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # 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. #
--------------- T H R E A D ---------------
Current thread (0x0000000001e94800): JavaThread "pool-1-thread-2" [_thread_in_native, id=30111, stack(0x00007f3d567e5000,0x00007f3d568e6000)]
RAX=0x0000000000000000 is an unknown value RBX=0x0000000000000000 is an unknown value RCX=0x0000000000000000 is an unknown value RDX=0x0000000000000050 is an unknown value RSP=0x00007f3d568e2280 is pointing into the stack for thread: 0x0000000001e94800 RBP=0x00007f3d568e2570 is pointing into the stack for thread: 0x0000000001e94800 ... 省略
如何分析
从hs-err-pid[pid].log文件中获取core dump线程id
gdb
1 2 3 4 5 6
(gdb) set solib-search-path $JAVA_HOME/jre/bin/ (gdb) file $JAVA_HOME/jre/bin/java (gdb) core java-230270-1551171676.core (gdb) bt or (gdb) where