JDK-8264940 : java/lang/invoke/6998541/Test6998541.java failed "guarantee(ik->is_initialized()) failed: java/lang/Byte$ByteCache must be initialized"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2021-04-08
  • Updated: 2022-04-02
  • Resolved: 2021-04-13
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 17
17 b18Fixed
Related Reports
Relates :  
Relates :  
Description
The following test failed in the JDK17 CI:

java/lang/invoke/6998541/Test6998541.java

Here's a snippet from the log file:

#section:main
----------messages:(4/381)----------
command: main -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:ScavengeRootsInCode=2 -DTest6998541.N=100000 -DTest6998541.KIND=normal Test6998541
reason: User specified action: run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:ScavengeRootsInCode=2 -DTest6998541.N=100000 -DTest6998541.KIND=normal Test6998541 
Mode: othervm [/othervm specified]
elapsed time (seconds): 24.021
----------configuration:(0/0)----------
----------System.out:(22/1928)----------
KIND=normal DO_CASTS=false N=100000
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/deoptimization.cpp:910
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/e8f948fe-dc79-4c12-82c8-0e7ba4ac7993-S93/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/cf974995-aef4-43b1-ac70-66bbe2eae3c9/runs/fe5c3182-302b-4e64-aef8-5dc976cf2046/workspace/open/src/hotspot/share/runtime/deoptimization.cpp:910), pid=2277, tid=2320
#  guarantee(ik->is_initialized()) failed: java/lang/Byte$ByteCache must be initialized
#
# JRE version: Java(TM) SE Runtime Environment (17.0+17) (fastdebug build 17-ea+17-LTS-1401)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+17-LTS-1401, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xad15d6]  BoxCache<signed char, java_lang_Byte_ByteCache, java_lang_Byte>::BoxCache(Thread*)+0x156
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S154438/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/af709e53-1c9d-4e6a-a2a8-0afdeccc289c/runs/1b696b83-85d8-42fe-935c-e10541ebc67b/testoutput/test-support/jtreg_open_test_jdk_jdk_lang/scratch/1/core.2277)
#
# An error report file with more information is saved as:
# /opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S154438/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/af709e53-1c9d-4e6a-a2a8-0afdeccc289c/runs/1b696b83-85d8-42fe-935c-e10541ebc67b/testoutput/test-support/jtreg_open_test_jdk_jdk_lang/scratch/1/hs_err_pid2277.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
----------System.err:(0/0)----------
----------rerun:(51/6245)*----------

Here's the crashing thread's stack:

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

Current thread (0x00007f4f183708e0):  JavaThread "MainThread" [_thread_in_vm, id=2320, stack(0x00007f4efdbfb000,0x00007f4efdcfc000)]

Stack: [0x00007f4efdbfb000,0x00007f4efdcfc000],  sp=0x00007f4efdcf76e0,  free space=1009k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xad15d6]  BoxCache<signed char, java_lang_Byte_ByteCache, java_lang_Byte>::BoxCache(Thread*)+0x156
V  [libjvm.so+0xac4e18]  Deoptimization::get_cached_box(AutoBoxObjectValue*, frame*, RegisterMap*, Thread*)+0x758
V  [libjvm.so+0xac5587]  Deoptimization::realloc_objects(JavaThread*, frame*, RegisterMap*, GrowableArray<ScopeValue*>*, Thread*)+0x6b7
V  [libjvm.so+0xacab78]  rematerialize_objects(JavaThread*, int, CompiledMethod*, frame&, RegisterMap&, GrowableArray<compiledVFrame*>*, bool&)+0x4f8
V  [libjvm.so+0xacbe8e]  Deoptimization::fetch_unroll_info_helper(JavaThread*, int)+0x49e
V  [libjvm.so+0xacf1a8]  Deoptimization::uncommon_trap(JavaThread*, int, int)+0x48

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
v  ~UncommonTrapBlob
J 2922 c2 Test6998541.byte2prim(B)V (161 bytes) @ 0x00007f4f0ddfe3c0 [0x00007f4f0ddfe3a0+0x0000000000000020]
J 2921 c2 Test6998541.dobyte()V (32 bytes) @ 0x00007f4f0de00870 [0x00007f4f0de00840+0x0000000000000030]
j  Test6998541.main([Ljava/lang/String;)V+23
v  ~StubRoutines::call_stub
J 1432  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@17-ea (0 bytes) @ 0x00007f4f0db0c18b [0x00007f4f0db0c0e0+0x00000000000000ab]
J 1430 c2 jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@17-ea (150 bytes) @ 0x00007f4f0db345c0 [0x00007f4f0db344c0+0x0000000000000100]
J 1429 c2 jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@17-ea (10 bytes) @ 0x00007f4f0db2f0a8 [0x00007f4f0db2f040+0x0000000000000068]
J 1416 c2 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@17-ea (65 bytes) @ 0x00007f4f0db289f0 [0x00007f4f0db28980+0x0000000000000070]
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
J 1386 c2 java.lang.Thread.run()V java.base@17-ea (17 bytes) @ 0x00007f4f0db1b02c [0x00007f4f0db1afc0+0x000000000000006c]
v  ~StubRoutines::call_stub

Looks like we crashed deoptimizing C2 stack frames so I'm
starting this off in hotspot/compiler for initial triage.
Comments
This fix is in jdk-17+18-1476.
13-04-2021

Changeset: c7975113 Author: Wang Huang <whuang@openjdk.org> Committer: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2021-04-13 16:41:57 +0000 URL: https://git.openjdk.java.net/jdk/commit/c7975113
13-04-2021

The failure reproduces quite frequently in our testing with the following VM args: -Xcomp -ea -esa -XX:CompileThreshold=100 -XX:-TieredCompilation
09-04-2021

I have reproduced this bug with option `-Xcomp -XX: -TieredCompilation`. The main reason is that in this situation the BoxCache is not initialized before `uncommon_trap`. I will fix this bug by initializing the class as early as possible. Thank you all. [~dcubed] [~kvn] [~thartmann]
09-04-2021

Hi, [~kvn] and [~thartmann], can you reproduce this bug every time? In my aarch64 machine, I can not reproduce this problem from over 1000 times.
09-04-2021

ILW = Guarantee failure during deopt, with single test at tier6, disable scalar replacement = HMM = P2
09-04-2021

Thank you [~kvn]. I will check this bug.
09-04-2021

Most likely related to JDK-8261137.
08-04-2021