hs_err_pid 文件中的编译事件是什么意思?

What is the meaning of Compilation Events at hs_err_pid file?

我的 JVM 崩溃了,生成的 hs_err_pid 文件中的堆栈跟踪指向某个方法。现在,我看到相同的方法也存在于名为 "Compilation events".

的较低子部分(在 Process 部分下)
  1. 这部分是什么意思?
  2. 从 JVM 在编译事件部分也指出的特定位置崩溃的事实中,我能理解什么?

以下是 hs_err_pid 文件中的相关打印件。请参阅两个部分的 computePath 0x00007f07d4434960

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f07d44359f6, pid=1, tid=0x00007f07acc30700
#
# JRE version: OpenJDK Runtime Environment (8.0_151-b12) (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
# Java VM: OpenJDK 64-Bit Server VM (25.151-b12 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J 17451 C2 com.mycompany.myproject.pf.service.PathComputationServiceBean.computePath(Lorg/jgrapht/GraphPath;)Lcom/mycompany/myproject/pf/model/ComputedPath; (972 bytes) @ 0x00007f07d44359f6 [0x00007f07d4434960+0x1096]
#
# Core dump written. Default location: /application/core or core.1
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
.
.
.
Compilation events (10 events):
Event: 77730.233 Thread 0x00007f07e018f000 17446       3       sun.net.www.http.KeepAliveCache::run (5 bytes)
Event: 77730.234 Thread 0x00007f07e018f000 nmethod 17446 0x00007f07d3c53010 code [0x00007f07d3c53180, 0x00007f07d3c53328]
Event: 77731.883 Thread 0x00007f07e018d800 17448   !   4       java.util.concurrent.ThreadPoolExecutor::getTask (179 bytes)
Event: 77731.890 Thread 0x00007f07e018d800 nmethod 17448 0x00007f07d3c47a10 code [0x00007f07d3c47be0, 0x00007f07d3c48210]
Event: 77901.463 Thread 0x00007f07e018f000 17449       3       sun.net.www.http.ClientVector::<init> (10 bytes)
Event: 77901.464 Thread 0x00007f07e018f000 nmethod 17449 0x00007f07d1976e90 code [0x00007f07d1977020, 0x00007f07d19772e8]
Event: 77963.888 Thread 0x00007f07e018f000 17450       3       sun.net.www.http.KeepAliveCache::<init> (15 bytes)
Event: 77963.888 Thread 0x00007f07e018f000 nmethod 17450 0x00007f07d1fbde50 code [0x00007f07d1fbdfc0, 0x00007f07d1fbe1b0]
Event: 78214.567 Thread 0x00007f07e018d800 17451       4       com.mycompany.myproject.pf.service.PathComputationServiceBean::computePath (972 bytes)
Event: 78214.857 Thread 0x00007f07e018d800 nmethod 17451 0x00007f07d44340d0 code [0x00007f07d4434960, 0x00007f07d44400a8]

"Compilation events" 显示哪些方法最近已从 Java 字节码编译为本机代码。如果您始终在同一方法中看到崩溃,这可能意味着您当前使用的 JVM 版本未正确编译此方法。

万一本机崩溃,您需要做的第一件事就是将 JVM 升级到最新版本。如果这没有帮助,您可以尝试重写有问题的方法(简化其逻辑,将其分解为更小的方法等),这有助于避免崩溃。

如果在同一个方法中反复崩溃,并且没有JVM的never版本可以下载,可以将该方法排除在编译之外。

参见“5.2.1 解决 HotSpot 编译器线程或编译代码中的崩溃问题” https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/crashes002.html