JDK-8308660 : C2 compilation hits 'node must be dead' assert
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,22,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-05-23
  • Updated: 2024-06-18
  • Resolved: 2024-03-19
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 21 JDK 23
21.0.5-oracleFixed 23 b15Fixed
Related Reports
Relates :  
Description
RenaissanceStressTest24H fails with:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error ((...)/src/hotspot/share/opto/phaseX.hpp:518), pid=15727, tid=15776
#  assert(dead->outcnt() == 0 && !dead->is_top()) failed: node must be dead
#
# JRE version: Java(TM) SE Runtime Environment (21.0+23) (fastdebug build 21-ea+23-LTS-1937)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-ea+23-LTS-1937, mixed mode, sharing, tiered, compressed class ptrs, z gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xe23ea7]  PhaseIterGVN::remove_dead_node(Node*)+0x117
...
---------------  T H R E A D  ---------------

Current thread (0x00007fd674287510):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=15776, stack(0x00007fd654eff000,0x00007fd655000000) (1028K)]


Current CompileTask:
C2:5012159 300833   !   4       com.sun.tools.javac.util.ByteBuffer::appendLong (53 bytes)

Stack: [0x00007fd654eff000,0x00007fd655000000],  sp=0x00007fd654ffaf60,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xe23ea7]  PhaseIterGVN::remove_dead_node(Node*)+0x117  (phaseX.hpp:518)
V  [libjvm.so+0xe1d5fb]  IfNode::fold_compares_helper(ProjNode*, ProjNode*, ProjNode*, PhaseIterGVN*)+0xc1b  (ifnode.cpp:1044)
V  [libjvm.so+0xe209bd]  IfNode::fold_compares(PhaseIterGVN*)+0x21d  (ifnode.cpp:1336)
V  [libjvm.so+0xe22c2a]  IfNode::Ideal(PhaseGVN*, bool)+0x11a  (ifnode.cpp:1463)
V  [libjvm.so+0x151699d]  PhaseIterGVN::transform_old(Node*)+0xcd  (phaseX.cpp:833)
V  [libjvm.so+0x1510441]  PhaseIterGVN::optimize()+0x81  (phaseX.cpp:1218)
V  [libjvm.so+0x9ef6c4]  Compile::Optimize()+0x234  (compile.cpp:2223)
V  [libjvm.so+0x9f2c65]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1aa5  (compile.cpp:839)
Comments
[jdk21u-fix-request] Approval Request from Martin Should get backported for parity with 21.0.5-oracle. Applies almost cleanly, has been reviewed and tier 1-4 have passed.
17-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/729 Date: 2024-06-14 15:59:38 +0000
14-06-2024

Changeset: 053ff76e Author: Roland Westrelin <roland@openjdk.org> Date: 2024-03-19 07:57:53 +0000 URL: https://git.openjdk.org/jdk/commit/053ff76e14046f796f6e10a9cb2ede1f1ae22ed6
19-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18305 Date: 2024-03-14 14:12:09 +0000
14-03-2024

That code was added by JDK-8269230 in JDK 17 b30. [~roland], could you please have a look?
05-01-2024

The problem is that 'adjusted_val' is top: #1 0x00007f1e39891bdb in IfNode::fold_compares_helper (this=this@entry=0x7f1e1c177ed8, proj=proj@entry=0x7f1e1c175b60, success=success@entry=0x7f1e1c178010, fail=fail@entry=0x7f1e1c177f78, igvn=igvn@entry=0x7f1e0dc2c550) at /oracle/jdk3/open/src/hotspot/share/opto/ifnode.cpp:1050 1050 igvn->remove_dead_node(adjusted_val); (rr) p adjusted_val->dump(0) 1 Con === 0 [[ ]] #top And that's because 'n' is an AddI with a top input here: 1028 Node* adjusted_val = igvn->transform(new SubINode(n, lo) (rr) p n->dump(1) 83 ConI === 0 [[ 84 95 106 11583 11210 11200 11190 1792 9958 1466 9282 546 538 1766 9097 9087 9077 8949 7982 7989 593 597 603 607 613 617 7713 7290 7164 2941 1788 2758 2748 2738 2495 1422 2494 1453 2387 2347 2289 2285 2279 2275 2269 2265 2218 767 2221 1773 2489 2164 2096 2075 2028 1617 1996 1563 1974 1585 1798 1664 1802 1542 1812 1808 1953 1885 11919 ]] #int:1 1 Con === 0 [[ ]] #top 1466 AddI === _ 1 83 [[ 1996 1503 1664 1585 1657 1617 1610 2075 2131 2021 2028 2068 ]] !orig=[11691],[11690] !jvms: BitSet::recalculateWordsInUse @ bci:34 (line 141) BitSet::clear @ bci:62 (line 553) DefaultListSelectionModel::clear @ bci:17 (line 329) DefaultListSelectionModel::changeSelection @ bci:82 (line 452) DefaultListSelectionModel::changeSelection @ bci:7 (line 469) DefaultListSelectionModel::addSelectionInterval @ bci:96 (line 572) JList::setSelectedIndices @ bci:57 (line 2257)
05-01-2024

I found another replay file (see attached replay_pid5417.log) from a JCK failure and that one worked: java -XX:+ReplayCompiles -XX:+ReplayIgnoreInitErrors -XX:ReplayDataFile=replay_pid5417.log -ea -esa -XX:+PrintCompilation -XX:-TieredCompilation -cp jck/JCK-runtime-22/classes/ -XX:+StressIGVN -XX:RepeatCompilation=1000 # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (workspace/open/src/hotspot/share/opto/phaseX.hpp:526), pid=3676967, tid=3676981 # assert(dead->outcnt() == 0 && !dead->is_top()) failed: node must be dead # # JRE version: Java(TM) SE Runtime Environment (23.0+4) (fastdebug build 23-ea+4-173) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-ea+4-173, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0xe1fc8f] PhaseIterGVN::remove_dead_node(Node*)+0x11f Current CompileTask: C2:8360 203 % b javax.swing.JList::setSelectedIndices @ 32 (69 bytes) Stack: [0x00007ff82f537000,0x00007ff82f638000], sp=0x00007ff82f6331a0, free space=1008k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0xe1fc8f] PhaseIterGVN::remove_dead_node(Node*)+0x11f (phaseX.hpp:526) V [libjvm.so+0xe18bcb] IfNode::fold_compares_helper(ProjNode*, ProjNode*, ProjNode*, PhaseIterGVN*)+0x9bb V [libjvm.so+0xe1b9cf] IfNode::fold_compares(PhaseIterGVN*)+0x1bf V [libjvm.so+0xe1dde7] IfNode::Ideal(PhaseGVN*, bool)+0x117 V [libjvm.so+0x153252d] PhaseIterGVN::transform_old(Node*)+0xbd V [libjvm.so+0x1528ee4] PhaseIterGVN::optimize()+0x94 V [libjvm.so+0x9ec139] Compile::Optimize()+0x1e9 V [libjvm.so+0x9f050b] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1beb V [libjvm.so+0x83dc57] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e7 V [libjvm.so+0x9fbb3f] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x99f V [libjvm.so+0x9fc758] CompileBroker::compiler_thread_loop()+0x468 V [libjvm.so+0xeb99ec] JavaThread::thread_main_inner()+0xcc V [libjvm.so+0x179ea66] Thread::call_run()+0xb6 It's with G1, so this bug is not ZGC specific.
05-01-2024

The new failures generated a replay file (see attached replay_pid10691.log) but I still couldn't reproduce the issue yet.
05-01-2024

This did not show up again and I'm not able to reproduce. There is a slight chance that this is another failure mode of JDK-8303512 so I'm closing this as Cannot Reproduce for now. Please re-open if this shows up again.
01-06-2023

I executed a full run with -XX:CompileCommand=option,com.sun.tools.javac.util.ByteBuffer::appendLong,DumpReplay but no replay was generated which seems to suggest that the offending method is often not even compiled. UPDATE: In the meantime, I was able to create some replay files (from passing runs) hoping that they might reproduce the issue with C2 stress options enabled. But unfortunately, no luck.
01-06-2023

I also had no luck in attaching to the core file with jhsdb to extract a replay file: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process) sun.jvm.hotspot.debugger.DebuggerException: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:428) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:338) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:158) at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.attachDebugger(CLHSDB.java:210)
25-05-2023

ILW = Assert due to removing a non-dead node, 4 occurrences so far in big apps, disable compilation of affected method = HLM = P3
24-05-2023

The call to PhaseIterGVN::remove_dead_node was added by JDK-8269230 in JDK 17 so it might be an old issue: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/ifnode.cpp#L1044 Since 'adjusted_val->outcnt() == 0' is checked, 'adjusted_val' must be top for the assert to trigger.
23-05-2023