JDK-8251544 : CTW: C2 fails with assert(no_dead_loop) failed: dead loop detected
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-08-13
  • Updated: 2020-10-16
  • Resolved: 2020-10-12
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 16
16 b20Fixed
Related Reports
Relates :  
Description
[You probably need JDK-8251526 to compile CTW in current jdk/jdk]

It does seem to happen only with ZGC. Parallel, G1, Shenandoah pass the test fine. I initially suspected -XX:-UseCompressedOops (set by ZGC) is the real reason, but G1 with -XX:-UseCompressedOops also passes.

Note it uses a specially passivated JAR file (that has more <clinits> stripped out to expose more classes to CTW).

$ cd test/hotspot/jtreg/testlibrary/ctw
$ make
$ cd dist
$ wget http://cr.openjdk.java.net/~shade/8251544/mule-module-scripting-jruby-3.9.0.jar
$ export JAVA_HOME=<point to fastdebug build>
$ JAVA_OPTIONS="-XX:+UseZGC" ./ctw.sh mule-module-scripting-jruby-3.9.0.jar

 24	ConI	===  0  [[ 966  25  583  48  595  571  644  632  620  161  174  187  352  589  577  565  626  638  650 ]]  #int:1
 966	AddI	=== _  966  24  [[ 966 ]]  !orig=[965] !jvms: DominatorTreeBuilder::buildDominatorTree @ bci:441
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/phaseX.cpp:923
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/shade/trunks/jdk-jdk/src/hotspot/share/opto/phaseX.cpp:923), pid=1986699, tid=1986817
#  assert(no_dead_loop) failed: dead loop detected
#
# JRE version: OpenJDK Runtime Environment (16.0) (fastdebug build 16-internal+0-adhoc.shade.jdk-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 16-internal+0-adhoc.shade.jdk-jdk, mixed mode, sharing, tiered, z gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x14b73c0]  PhaseGVN::dead_loop_check(Node*)+0x160
Comments
Changeset: 54bbe76e Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2020-10-12 08:18:13 +0000 URL: https://git.openjdk.java.net/jdk/commit/54bbe76e
12-10-2020

I can now also reproduce this with G1 with the attached test.jar which just contains the modified failing class, so it is unrelated to ZGC: $ ./ctw.sh test.jar CompileCommand: exclude java/lang/invoke/MethodHandle.* # jar: test.jar [1] dep.Test Warning: 'NoSuchMethodError' on register of sun.hotspot.WhiteBox::deflateIdleMonitors()Z [2] dep.BasicBlock 23 ConI === 0 [[ 1381 24 1007 49 1074 1062 1068 1056 1044 163 176 189 641 1013 1001 989 1050 995 1019 ]] #int:1 1381 AddI === _ 1381 23 [[ 1414 1382 1381 ]] !orig=[1380] !jvms: Test::buildDominatorTree @ bci:225 # To suppress the following error report, specify this argument # after -XX: or in .hotspotrc: SuppressErrorAt=/phaseX.cpp:926 # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/home/christian/jdk/open/src/hotspot/share/opto/phaseX.cpp:926), pid=26753, tid=26765 # assert(no_dead_loop) failed: dead loop detected # # JRE version: Java(TM) SE Runtime Environment (16.0) (slowdebug build 16-internal+0-2020-08-18-1334054.christian...) # Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 16-internal+0-2020-08-18-1334054.christian..., mixed mode, tiered, compressed oops, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0xf0c1df] PhaseGVN::dead_loop_check(Node*)+0x1ad # # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # Unsupported internal testing APIs have been used. # An error report file with more information is saved as: # /home/christian/jdk/open/test/hotspot/jtreg/testlibrary/ctw/dist/hs_err_pid26753.log # # Compiler replay data is saved as: # /home/christian/jdk/open/test/hotspot/jtreg/testlibrary/ctw/dist/replay_pid26753.log # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # ./ctw.sh: line 1: 26753 Aborted java ${JAVA_OPTIONS} --add-exports java.base/jdk.internal.jimage=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.reflect=ALL-UNNAMED --add-exports java.base/jdk.internal.access=ALL-UNNAMED -XX:-UseCounterDecay -Xbatch "-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*" -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar $@
25-08-2020

[~chagedorn] Thanks for taking a look at this.
14-08-2020

It starts failing after JDK-8237950. But that fix only disabled an optimization. I guess it just revealed a problem that was there before.
14-08-2020

I've just verified that this bug is reproducible (replay file attached) with one of the latest build containing the fix for JDK-8249605. So, it must be a different problem. I will take a closer look.
14-08-2020

[~shade] Was this with the latest jdk/jdk changes? I'm asking since [~chagedorn] recently fixed something that looks similar: https://bugs.openjdk.java.net/browse/JDK-8249605
14-08-2020