JDK-8295788 : C2 compilation hits "assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,19,20
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-10-21
  • Updated: 2023-01-12
  • Resolved: 2022-11-18
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 20
11.0.19-oracleFixed 17.0.7-oracleFixed 20 b25Fixed
Related Reports
Relates :  
Relates :  
Description
The following test failed in the JDK20 CI:

applications/javafuzzer/MediumTest.java

Here's a snippet from the log file:

Summary of the JavaFuzzer run:
------------------------------
Host:     ol8-aarch64-832091
Tests:    8 x 50
Args:     -conf config.yml

Started  at: Fri Oct 21 01:24:42 UTC 2022


r1- 50: 36 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 14 Reference Java failures
r4- 50: 36 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 14 Reference Java failures
r6- 50: 34 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 16 Reference Java failures
r7- 50: 33 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 17 Reference Java failures
r3- 50: 30 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 20 Reference Java failures
r2- 50: 31 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 19 Reference Java failures
r8- 50: 29 passed, 2 crashes, 0 fails, 0 hangs, 0 incorrect tests, 20 Reference Java failures
r5- 50: 33 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 17 Reference Java failures

Finished at: Fri Oct 21 02:41:00 UTC 2022


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S94858/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/bad20306-ee82-4a61-b8c5-d4fc93ef82c4/runs/34267369-fc6d-4d4a-bc89-ab6463246786/workspace/open/src/hotspot/share/opto/loopopts.cpp:2029), pid=4015835, tid=4015854
#  assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node
#
# JRE version: Java(TM) SE Runtime Environment (20.0+21) (fastdebug build 20-ea+21-1477)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 20-ea+21-1477, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x12c8d9c]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x688
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /tmp/fuzzer.tmp.E5qwPl1JQF/core.4015835)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S94858/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/bad20306-ee82-4a61-b8c5-d4fc93ef82c4/runs/34267369-fc6d-4d4a-bc89-ab6463246786/workspace/open/src/hotspot/share/opto/loopopts.cpp:2029), pid=4016103, tid=4016117
#  assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node
#
# JRE version: Java(TM) SE Runtime Environment (20.0+21) (fastdebug build 20-ea+21-1477)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 20-ea+21-1477, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x12c8d9c]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x688
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /tmp/fuzzer.tmp.E5qwPl1JQF/core.4016103)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

[2022-10-21T02:41:00.576880951Z] Waiting for completion for process 3987624
[2022-10-21T02:41:00.577065552Z] Waiting for completion finished for process 3987624
----------System.err:(13/728)----------
java.lang.RuntimeException: assertEquals: expected 1 to equal 2
	at jdk.test.lib.Asserts.fail(Asserts.java:594)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:205)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:189)
	at applications.javafuzzer.JavaFuzzerRunner.main(JavaFuzzerRunner.java:245)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
	at java.base/java.lang.Thread.run(Thread.java:1591)

JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: assertEquals: expected 1 to equal 2


Here's the stack track from the first crash:

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

Current thread (0x0000fffd1434e500):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4015854, stack(0x0000fffced800000,0x0000fffceda00000)]


Current CompileTask:
C2:    315   12    b  4       Test::dMeth (269 bytes)

Stack: [0x0000fffced800000,0x0000fffceda00000],  sp=0x0000fffced9f95b0,  free space=2021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12c8d9c]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x688  (loopopts.cpp:2029)
V  [libjvm.so+0x12cb594]  PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x2e0  (loopopts.cpp:2454)
V  [libjvm.so+0x128941c]  PhaseIdealLoop::insert_post_loop(IdealLoopTree*, Node_List&, CountedLoopNode*, CountedLoopEndNode*, Node*&, Node*, CountedLoopNode*&)+0xcc  (loopTransform.cpp:1976)
V  [libjvm.so+0x128a950]  PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree*, Node_List&, bool)+0x300  (loopTransform.cpp:1661)
V  [libjvm.so+0x128c234]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x4e4  (loopTransform.cpp:3863)
V  [libjvm.so+0x128c474]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x114  (loopTransform.cpp:3931)
V  [libjvm.so+0x128c3ac]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x4c  (loopTransform.cpp:3915)
V  [libjvm.so+0x12b8c80]  PhaseIdealLoop::build_and_optimize()+0xc6c  (loopnode.cpp:4510)
V  [libjvm.so+0x98ee60]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x1e0  (loopnode.hpp:1082)
V  [libjvm.so+0x98bd0c]  Compile::Optimize()+0x408  (compile.cpp:2365)
V  [libjvm.so+0x98dc18]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xfe8  (compile.cpp:831)
V  [libjvm.so+0x7b3d08]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1c4  (c2compiler.cpp:113)
V  [libjvm.so+0x99a554]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa34  (compileBroker.cpp:2237)
V  [libjvm.so+0x99adbc]  CompileBroker::compiler_thread_loop()+0x3b8  (compileBroker.cpp:1916)
V  [libjvm.so+0xeb0de0]  JavaThread::thread_main_inner()+0x21c  (javaThread.cpp:699)
V  [libjvm.so+0x17b3078]  Thread::call_run()+0xf8  (thread.cpp:224)
V  [libjvm.so+0x14c73d4]  thread_native_entry(Thread*)+0x100  (os_linux.cpp:710)
C  [libpthread.so.0+0x7908]  start_thread+0x188


Here's the stack trace from the second crash:

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

Current thread (0x0000fffc2434dad0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4016117, stack(0x0000fffc06fc0000,0x0000fffc071c0000)]


Current CompileTask:
C2:    206    7    b        Test::dMeth (269 bytes)

Stack: [0x0000fffc06fc0000,0x0000fffc071c0000],  sp=0x0000fffc071b95b0,  free space=2021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12c8d9c]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x688  (loopopts.cpp:2029)
V  [libjvm.so+0x12cb594]  PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x2e0  (loopopts.cpp:2454)
V  [libjvm.so+0x128941c]  PhaseIdealLoop::insert_post_loop(IdealLoopTree*, Node_List&, CountedLoopNode*, CountedLoopEndNode*, Node*&, Node*, CountedLoopNode*&)+0xcc  (loopTransform.cpp:1976)
V  [libjvm.so+0x128a950]  PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree*, Node_List&, bool)+0x300  (loopTransform.cpp:1661)
V  [libjvm.so+0x128c234]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x4e4  (loopTransform.cpp:3863)
V  [libjvm.so+0x128c474]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x114  (loopTransform.cpp:3931)
V  [libjvm.so+0x128c3ac]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x4c  (loopTransform.cpp:3915)
V  [libjvm.so+0x12b8c80]  PhaseIdealLoop::build_and_optimize()+0xc6c  (loopnode.cpp:4510)
V  [libjvm.so+0x98ee60]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x1e0  (loopnode.hpp:1082)
V  [libjvm.so+0x98bd0c]  Compile::Optimize()+0x408  (compile.cpp:2365)
V  [libjvm.so+0x98dc18]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xfe8  (compile.cpp:831)
V  [libjvm.so+0x7b3d08]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1c4  (c2compiler.cpp:113)
V  [libjvm.so+0x99a554]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa34  (compileBroker.cpp:2237)
V  [libjvm.so+0x99adbc]  CompileBroker::compiler_thread_loop()+0x3b8  (compileBroker.cpp:1916)
V  [libjvm.so+0xeb0de0]  JavaThread::thread_main_inner()+0x21c  (javaThread.cpp:699)
V  [libjvm.so+0x17b3078]  Thread::call_run()+0xf8  (thread.cpp:224)
V  [libjvm.so+0x14c73d4]  thread_native_entry(Thread*)+0x100  (os_linux.cpp:710)
C  [libpthread.so.0+0x7908]  start_thread+0x188
Comments
Fix request [17u] I backport this for parity with 17.0.7-oracle. Medium C2 change with the typical risk. Test reproduces issue. We should take it. Clean backport. Test passes and fails without the fix. SAP nightly testing passed.
07-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1031 Date: 2023-01-04 10:46:05 +0000
04-01-2023

Changeset: 761a4f48 Author: Roland Westrelin <roland@openjdk.org> Date: 2022-11-18 13:46:01 +0000 URL: https://git.openjdk.org/jdk/commit/761a4f4852cbb40660b6fb9eda4d740464218f75
18-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11162 Date: 2022-11-15 11:42:00 +0000
15-11-2022

Sorry, forgot to attach the test. To reproduce, run with: java -Xmx1G -Xcomp -Xbatch -XX:CompileOnly=Test -XX:CompileCommand=quiet -XX:MaxRAMPercentage=6.25 Test.java
25-10-2022

I narrowed it down to JDK-8281429 but it's likely that this only triggers and existing issue. [~roland] could you please have a look?
21-10-2022

Quickly executed build search, looks like it was introduced/first triggered in jdk-19+22.
21-10-2022

ILW = Assert during C2 compilation, single test but easy to reproduce, disable loop strip mining (-XX:LoopStripMiningIter=0) = HMM = P2
21-10-2022