JDK-8228601 : AArch64: Fix interpreter code at JVMCI deoptimization entry
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,12,13,14
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: aarch64
  • Submitted: 2019-07-25
  • Updated: 2020-07-06
  • Resolved: 2019-07-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.5Fixed 13 b32Fixed 14Fixed
Description
[Issue]
HotSpot crashes after a Graal-compiled synchronized method is deoptimized and then returned in interpreter. This happens only on AArch64.

[Reproduce]
This can be reproduced by below Java program with VM options
"-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=graal".

public class Test {
  public static synchronized int hash(Object o) { return o.hashCode(); }
  public static void main(String[] args) throws Exception {
    int sum = 0;
    for (int i = 0; i < 30000; i++) {
      sum += hash(i);
      Thread.sleep(1);
    }
    sum += hash("Shanghai");
    System.out.println(sum);
  }
}

$ javac Test.java
$ 
$ java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=graal Test
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0x7) at pc=0x0000ffff8f93b9b4, pid=12666, tid=12667
#
# JRE version: OpenJDK Runtime Environment (12.0) (build 12-internal+0-adhoc.penli01.jdksrc)
# Java VM: OpenJDK 64-Bit Server VM (12-internal+0-adhoc.penli01.jdksrc, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, g1 gc, linux-aarch64)
# Problematic frame:
# j  Test.hash(Ljava/lang/Object;)I+4
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/penli01/core.12666)
#
# An error report file with more information is saved as:
# /home/penli01/hs_err_pid12666.log
Loaded disassembler from /usr/lib/jvm/jdk-12/lib/hsdis-aarch64.so
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Aborted (core dumped)

---------------  S U M M A R Y ------------

Command Line: -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=graal Test

Host: AArch64, 224 cores, 125G, Ubuntu 18.04.2 LTS
Time: Fri Jul 26 01:21:31 2019 UTC elapsed time: 32 seconds (0d 0h 0m 32s)

---------------  T H R E A D  ---------------

Current thread (0x0000ffffac011000):  JavaThread "main" [_thread_in_Java, id=12667, stack(0x0000ffffb1e5a000,0x0000ffffb205a000)]

Stack: [0x0000ffffb1e5a000,0x0000ffffb205a000],  sp=0x0000ffffb2058310,  free space=2040k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
j  Test.hash(Ljava/lang/Object;)I+4
j  Test.main([Ljava/lang/String;)V+34
v  ~StubRoutines::call_stub
V  [libjvm.so+0x6ee4d4]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x364
V  [libjvm.so+0x76ff58]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.67] [clone .constprop.192]+0x280
V  [libjvm.so+0x772544]  jni_CallStaticVoidMethod+0x12c
C  [libjli.so+0x5974]  JavaMain+0xe84
C  [libpthread.so.0+0x7088]  start_thread+0xb0


siginfo: si_signo: 7 (SIGBUS), si_code: 1 (BUS_ADRALN), si_addr: 0x00000000d74e312b


Comments
Fix Request (regarding jdk11u) I would like to have this patch backported to jdk11u as well. For details see above request for jdk13. I've run tier1 with Graal and no new failure is found. This patch applies cleanly.
05-08-2019

URL: https://hg.openjdk.java.net/jdk/jdk13/rev/76a82db7181a User: njian Date: 2019-07-31 01:57:25 +0000
31-07-2019

Fix request approved.
30-07-2019

Fix Request This issue causes AArch64 HotSpot crash when a Graal-compiled synchronized method gets deoptimized. The root cause is a mistake in generated interpreter code at method deoptimization entry for JVMCI. (Some details: Before re-executing deoptimized Java method in interpreter, we should check the thread local value from _pending_monitorenter_offset to see if it's a synchronized method. But now _pending_exception_offset is used instead of _pending_monitorenter_offset is by mistake.) We have created a patch ( http://cr.openjdk.java.net/~pli/rfr/8228601/webrev.00/ ) to fix. The risk of fixing this issue is low. We have done full jtreg test with Graal for this patch. No new jtreg failures found. And, we've found below 3 jtreg failures get fixed with AArch64 Graal after this patch. * jdk/java/util/Map/InPlaceOpsCollisions.java * jdk/sun/security/tools/keytool/KeyToolTest.java * hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java The patch is currently reviewed by adinn and aph.
29-07-2019

The patch that fixes this issue is reviewed. See https://mail.openjdk.java.net/pipermail/aarch64-port-dev/2019-July/007709.html The issue was introduced in AArch64 HotSpot code long time ago. We are considering backport this fix to jdk13 and/or jdk11u.
29-07-2019