JDK-8268019 : C2: assert(no_dead_loop) failed: dead loop detected
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-06-01
  • Updated: 2022-02-06
  • Resolved: 2021-07-29
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 17 JDK 18
11.0.14-oracleFixed 17.0.1Fixed 18 b09Fixed
Description
The attached fuzzer test fails intermittently with the following assertion:

To reproduce (fails 1 out of 5-6 times):
$ java -Xcomp -XX:CompileOnly=Test -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:RepeatCompilation=100 Test.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/3c846bae-ce30-4a97-93ee-9fef4497ccb6-S79226/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/0cb697b6-5006-4d18-afca-8f82d7082f5e/runs/5d51f3ad-e036-4803-805d-9e13517ddb05/workspace/open/src/hotspot/share/opto/phaseX.cpp:945), pid=19896, tid=19909
#  assert(no_dead_loop) failed: dead loop detected
#
# JRE version: Java(TM) SE Runtime Environment (17.0+25) (fastdebug build 17-ea+25-LTS-2214)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+25-LTS-2214, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x15ef6e6]  PhaseGVN::dead_loop_check(Node*) [clone .part.0]+0x156
.............
Command Line: -Xcomp -XX:CompileOnly=Test -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:RepeatCompilation=100 --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main Test.java
.............
Current thread (0x00007ff92c235ce0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=19909, stack(0x00007ff903cfd000,0x00007ff903dfe000)]


Current CompileTask:
C2:   3925   83    b        Test::mainTest (577 bytes)

Stack: [0x00007ff903cfd000,0x00007ff903dfe000],  sp=0x00007ff903df9420,  free space=1009k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x15ef6e6]  PhaseGVN::dead_loop_check(Node*) [clone .part.0]+0x156
V  [libjvm.so+0x15fdb29]  PhaseIterGVN::transform_old(Node*)+0x609
V  [libjvm.so+0x15f63ae]  PhaseIterGVN::optimize()+0x7e
V  [libjvm.so+0xa19106]  Compile::Optimize()+0x216
V  [libjvm.so+0xa1bec5]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1585
V  [libjvm.so+0x841aba]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1ea
V  [libjvm.so+0xa2c8e3]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x1013
V  [libjvm.so+0xa2d5f8]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x18a3a11]  JavaThread::thread_main_inner()+0x271
V  [libjvm.so+0x18ab610]  Thread::call_run()+0x100
V  [libjvm.so+0x157721e]  thread_native_entry(Thread*)+0x10e
Comments
Fix Request (11u): Should get backported for parity with 11.0.14-oracle. Applies cleanly, but test needs modification. Review: https://github.com/openjdk/jdk11u-dev/pull/342
14-09-2021

I've already pushed the backport to JDK 17u and forgot to request approval. Doing this now: Fix request (17u): The bug leads to a crash in C2. The fix is low risk (slow call) and has been tested in the JDK 18 and Oracle JDK 11u CI for a while and with tier1-3 in JDK 17u. The patch applies cleanly.
23-08-2021

Changeset: 489e5fd1 Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2021-07-29 09:31:22 +0000 URL: https://git.openjdk.java.net/jdk/commit/489e5fd12a37a45f4f5ea64b05f85c6f99f70811
29-07-2021

Could not reproduce this before JDK 16+18 (introduced StressIGVN) or in 11u (no StressIGVN and RepeatCompilation available). But it's likely that this problem also affects 11u and earlier versions before 16.
08-06-2021

ILW = C2 assertion during IGVN, only fails intermittently with single Java Fuzzer test, disable compilation of affected method = HLM = P3
01-06-2021