【发布时间】:2022-06-15 14:50:12
【问题描述】:
我目前使用的是JDK8,在17.4.2 Collect Core Dumps on Linux中,有如下描述:
默认情况下,核心转储是在进程的当前工作目录中创建的,核心转储文件的名称是 core.pid,其中 pid 是崩溃的 Java 进程的进程 ID。
但是我想改变core dump的路径,有什么办法可以实现吗?
我是用sysctl -wq kernel.core_pattern=/opt/shared/core_%e.%p设置的,但是对JVM进程不起作用。
我用kill -11 java_pid模拟这种情况,但是core dump是在JVM进程工作目录生成的,不是我设置的目录。
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f6249b4e4a5, pid=1, tid=0x00007f6249b3cb80
#
# JRE version: OpenJDK Runtime Environment (8.0_332-b09) (build 1.8.0_332-b09)
# Java VM: OpenJDK 64-Bit Server VM (25.332-b09 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libpthread.so.0+0xa4a5] __pthread_clockjoin_ex+0x235
#
# Core dump written. Default location: /opt/core or core.1
#
# An error report file with more information is saved as:
# /opt/shared/java_error.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
[error occurred during error reporting , id 0xb]
【问题讨论】: