当我运行 jar 应用程序时,jvm 因错误而崩溃
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000000003fd6, pid=7, tid=0x00007ff273404b38
#
# JRE version: OpenJDK Runtime Environment (Zulu 8.60.0.22-SA-linux-musl-x64) (8.0_322-b06) (build 1.8.0_322-b06)
# Java VM: OpenJDK 64-Bit Server VM (25.322-b06 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C 0x0000000000003fd6
#
# Core dump written. Default location: /usr/app/core or core.7
#
# An error report file with more information is saved as:
# /usr/app/hs_err_pid7.log
#
# If you would like to submit a bug report, please visit:
# http://www.azul.com/support/
#
错误说报告文件已保存
hs_err_pid7.log
,但我无法查看它,因为一旦jvm崩溃,容器就会停止运行,有没有办法将此文件保存在容器之外?您也许能够将 hs_err_pidx.log 的内容获取到容器的日志中。 IE。将
ErrorFile
属性设置为 /proc/1/fd/1
。
可以直接通过命令参数设置:
-XX:ErrorFile=/proc/1/fd/1'
...或通过环境变量。例如:
_JAVA_OPTIONS='-XX:ErrorFile=/proc/1/fd/1'
对我来说,这可以在 Kubernetes 上运行的容器中运行,该容器具有基于 Alpine 的映像和 RedHat OpenJDK 17。
尝试挂载持久卷而不是绑定卷!