JDK-8258015 : [JVMCI] JVMCI_lock shouldn't be held while initializing box classes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-10
  • Updated: 2021-01-15
  • Resolved: 2020-12-10
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 16 JDK 17
11.0.11-oracleFixed 16Fixed 17 b01Fixed
Related Reports
Relates :  
Description
Following tests failed after JDK-8257917
```
compiler/aot/calls/fromAot/AotInvokeInterface2InterpretedTest.java
compiler/aot/calls/fromAot/AotInvokeDynamic2NativeTest.java
compiler/aot/calls/fromAot/AotInvokeDynamic2InterpretedTest.java
compiler/aot/calls/fromAot/AotInvokeSpecial2NativeTest.java
compiler/aot/calls/fromAot/AotInvokeDynamic2CompiledTest.java
compiler/aot/calls/fromAot/AotInvokeStatic2CompiledTest.java
compiler/aot/calls/fromAot/AotInvokeDynamic2AotTest.java
compiler/aot/calls/fromAot/AotInvokeInterface2NativeTest.java
compiler/aot/calls/fromAot/AotInvokeStatic2AotTest.java
compiler/aot/calls/fromAot/AotInvokeInterface2CompiledTest.java
compiler/aot/calls/fromAot/AotInvokeSpecial2CompiledTest.java
compiler/aot/calls/fromAot/AotInvokeInterface2AotTest.java
compiler/aot/calls/fromAot/AotInvokeSpecial2AotTest.java
compiler/aot/calls/fromAot/AotInvokeSpecial2InterpretedTest.java
compiler/aot/calls/fromAot/AotInvokeStatic2InterpretedTest.java
compiler/aot/calls/fromAot/AotInvokeStatic2NativeTest.java
compiler/aot/calls/fromAot/AotInvokeVirtual2AotTest.java
compiler/aot/calls/fromAot/AotInvokeVirtual2CompiledTest.java
compiler/aot/calls/fromAot/AotInvokeVirtual2InterpretedTest.java
compiler/aot/calls/fromCompiled/CompiledInvokeDynamic2AotTest.java
compiler/aot/calls/fromCompiled/CompiledInvokeInterface2AotTest.java
compiler/aot/calls/fromAot/AotInvokeVirtual2NativeTest.java
compiler/aot/calls/fromCompiled/CompiledInvokeStatic2AotTest.java
compiler/aot/calls/fromCompiled/CompiledInvokeSpecial2AotTest.java
compiler/aot/calls/fromCompiled/CompiledInvokeVirtual2AotTest.java
compiler/aot/calls/fromInterpreted/InterpretedInvokeDynamic2AotTest.java
compiler/aot/calls/fromInterpreted/InterpretedInvokeStatic2AotTest.java
compiler/aot/calls/fromInterpreted/InterpretedInvokeSpecial2AotTest.java
compiler/aot/calls/fromInterpreted/InterpretedInvokeInterface2AotTest.java
compiler/aot/calls/fromInterpreted/InterpretedInvokeVirtual2AotTest.java
compiler/aot/calls/fromNative/NativeInvokeSpecial2AotTest.java
compiler/aot/calls/fromNative/NativeInvokeStatic2AotTest.java
compiler/aot/calls/fromNative/NativeInvokeVirtual2AotTest.java
compiler/aot/cli/jaotc/AtFileTest.java
compiler/aot/cli/jaotc/CompileAbsoluteDirectoryTest.java
compiler/aot/cli/jaotc/CompileClassTest.java
compiler/aot/cli/jaotc/CompileClassWithDebugTest.java
compiler/aot/cli/jaotc/CompileDirectoryTest.java
compiler/aot/cli/jaotc/CompileJarTest.java
```

```
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/root/jdk/src/hotspot/share/runtime/thread.cpp:795), pid=775346, tid=775349
#  assert(false) failed: Possible safepoint reached by thread that does not allow it
#
# JRE version: OpenJDK Runtime Environment (16.0+4) (fastdebug build 16-internal+4-adhoc.root.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 16-internal+4-adhoc.root.jdk, mixed mode, aot, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x180c9e6]  Thread::check_for_valid_safepoint_state()+0x106
#

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

Current thread (0x00007f7320026b90):  JavaThread "main" [_thread_in_vm, id=128173, stack(0x00007f732af11000,0x00007f732b012000)]

Stack: [0x00007f732af11000,0x00007f732b012000],  sp=0x00007f732b0106f0,  free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x180c7e6]  Thread::check_for_valid_safepoint_state()+0x106
V  [libjvm.so+0x17a0c1e]  ObjectLocker::ObjectLocker(Handle, Thread*, bool)+0x2e
V  [libjvm.so+0xd529aa]  InstanceKlass::link_class_impl(Thread*)+0x1ba
V  [libjvm.so+0xd53993]  InstanceKlass::initialize_impl(Thread*)+0x43
V  [libjvm.so+0xf58994]  JVMCI::ensure_box_caches_initialized(Thread*)+0x164
V  [libjvm.so+0x58e62b]  AOTLoader::initialize_box_caches(Thread*)+0x5b
V  [libjvm.so+0x1818039]  Threads::initialize_java_lang_classes(JavaThread*, Thread*)+0xba9
V  [libjvm.so+0x1818b3d]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x43d
V  [libjvm.so+0xed0a79]  JNI_CreateJavaVM+0x99
C  [libjli.so+0x75ba]  JavaMain+0x8a
C  [libjli.so+0xae99]  ThreadJavaMain+0x9
```
Comments
https://github.com/graalvm/labs-openjdk-11/commit/ad1de61eb9730a7b25eb89ba94ac75388f5dec66
12-01-2021

Changeset: fa77008f Author: Doug Simon <dnsimon@openjdk.org> Date: 2020-12-10 21:18:35 +0000 URL: https://git.openjdk.java.net/jdk/commit/fa77008f
15-12-2020

[~dnsimon] Igor I. suggested to change PR's title to (original commit long hash): Backport d163c6fe2ec235a175b62ec821477d33b14841fe No ':'
10-12-2020

Ok, I opened https://github.com/openjdk/jdk16/pull/1. It has this warning: ������ Issue is not open. So I guess we need to explicitly open backport issues now?
10-12-2020

[~dnsimon] It looks like for now backport to JDK 16 follow the same process as usual PR with reviews.
10-12-2020

I am asking about process and will let you know. My current understanding is the process is exactly the same with using your fork of jdk16. Moving forward (until jdk 16 release) fix bugs first in jdk 16 repo and it will be automatically pushed into jdk 17.
10-12-2020

Ok. Is that just a matter of opening a PR on https://github.com/openjdk/jdk16?
10-12-2020

The fix missed JDK16 fork. It needs to be backported to https://github.com/openjdk/jdk16
10-12-2020

Changeset: d163c6fe Author: Doug Simon <dnsimon@openjdk.org> Date: 2020-12-10 16:16:25 +0000 URL: https://git.openjdk.java.net/jdk/commit/d163c6fe
10-12-2020

ILW = Assert because locking is not allowed (regression), with AOT tests, no workaround = HLH = P2
10-12-2020