JDK-8276902 : ciReplay: failure in ciObjectFactory.cpp with assertion "must be whitelisted for replay compilation"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2021-11-09
  • Updated: 2021-11-15
  • Resolved: 2021-11-15
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 18
18Resolved
Related Reports
Duplicate :  
Relates :  
Description
There a lot of crashes like below when trying to run different jdk tests with -XX:CompileCommand=option,*::*,DumpReplay and then with 
"XX:+ReplayCompiles -XX:ReplayDataFile=..."

#  Internal Error (/home/katya/work/JavaSE/Hotspot/ws/git/jdk.jdk.master/open/src/hotspot/share/ci/ciObjectFactory.cpp:381), pid=360, tid=376
#  assert(!ReplayCompiles || ciReplay::no_replay_state() || !ciReplay::is_klass_unresolved((InstanceKlass*)k)) failed: must be whitelisted for replay compilation
#
# JRE version: Java(TM) SE Runtime Environment (18.0) (fastdebug build 18-internal+0-2021-11-08-2032029.katya...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 18-internal+0-2021-11-08-2032029.katya..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x9047c1]  ciObjectFactory::create_new_metadata(Metadata*)+0x701



Comments
I had a closer look on how the replay file was produced (posted in JDK-8276392). It seems that the original compilation emits an unstable_if uncommon trap for the block containing the constant field on bci 46 (bci 27 is the if jumping to bci 46): @ bci:23 @ bci:25 @ bci:27 // iflt 46 Uncommon trap reason='unstable_if' action='reinterpret' debug_id='0' at bci:27 Merging state at block #5 bci:30 with empty state on path 1 Parsing block #5 at bci [30,46), successors: 6 However, when replay compiling, we have different profiling information and we do not emit the trap and thus we are going to parse the constant field on bci 46: @ bci:23 @ bci:25 @ bci:27 Merging state at block #8 bci:46 with empty state on path 1 Merging state at block #5 bci:30 with empty state on path 1 Parsing block #5 at bci [30,46), successors: 6 .... Parsing block #8 at bci [46,64), successors: @ bci:46 // getstatic #7 // Field java/util/zip/ZipCoder.JLA:Ljdk/internal/access/JavaLangAccess; That's the reason why the original compilation did not load the ciInstanceKlass for the constant field value. The reason why we have different profiling information is that the invocation count in 0 when replay compiling. This is fixed by JDK-8276095. When applying it, we also emit the uncommon trap for the block at bci 46 when replay compiling and we do not hit the whitelist assertion anymore because we are not attempting to parse the field with its unloaded instance klass value. It seems that the assertion was an indicator that replay compilation is doing a different parsing than the original compilation (which is fixed by JDK-8276095). Therefore, I'm closing this bug as a dup of JDK-8276095. Just generally loading the ciInstanceKlass of all field values seems to be wrong if the original compilation did not do that (i.e. no entry in the replay file).
15-11-2021

Christian ([~chagedorn]), I applied your fix and no more crashes. However I see a lot of NoClassDefFoundError now: java.lang.NoClassDefFoundError: null Caused by: java.lang.ClassNotFoundException: null at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@18-internal/BuiltinClassLoader.java:641) at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@18-internal/ClassLoaders.java:188) at java.lang.ClassLoader.loadClass(java.base@18-internal/ClassLoader.java:521) To reproduce do for example: > cp test/jdk/java/lang/String/Indent.java . > $TESTED_JDK/bin/javac Indent.java > download replay_bug8276902_patch.log > $TESTED_JDK/bin/jjava -XX:+ReplayCompiles -XX:ReplayDataFile=replay_bug8276902_patch.log
11-11-2021

@christian, this looks related to 8262912. In particular, if a staticfield entry is using a subclass: staticfield java/util/zip/ZipCoder JLA Ljdk/internal/access/JavaLangAccess; java/lang/System$2 then the subclass isn't guaranteed to have a ciInstanceKlass line, which means it won't be on the whitelist.
10-11-2021

ILW = replay failure = MMH = P3
10-11-2021

To reproduce run > java -XX:+ReplayCompiles -XX:ReplayDataFile=replay_bug8276902.log
09-11-2021