JDK-8308392 : [Umbrella] C2: assert(false) failed: malformed control flow
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,20,21,22,24
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-05-18
  • Updated: 2024-09-16
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 25
25Unresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8317998 :  
JDK-8318000 :  
Description
The following test failed in the JDK21 CI:

java/util/concurrent/tck/JSR166TestCase.java

Here's a snippet from the log file:

#section:junit
----------messages:(7/375)----------
command: junit -Djava.security.manager=allow JSR166TestCase
reason: User specified action: run junit/othervm/timeout=1000 -Djava.security.manager=allow JSR166TestCase 
started: Thu May 18 19:35:28 UTC 2023
Mode: othervm [/othervm specified]
Additional options from @modules: --add-modules java.management
finished: Thu May 18 19:38:09 UTC 2023
elapsed time (seconds): 161.27
----------configuration:(3/43)----------
Boot Layer
  add modules: java.management

----------System.out:(30/2324)----------
dist dump
---------------------------------------------
   0   748  If  === 886 980  [[ 559 ]] P=0.008410, C=-1.000000 !orig=[2622] !jvms: AbstractPipeline::copyInto @ bci:38 (line 510) ForEachOps$ForEachTask::compute @ bci:103 (line 291)
   1   559  IfTrue  === 748  [[ 361 ]] #1 !orig=[2624] !jvms: AbstractPipeline::copyInto @ bci:38 (line 510) ForEachOps$ForEachTask::compute @ bci:103 (line 291)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/741e9afd-8c02-45c3-b2e2-9db1450d0832-S108520/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/c494988c-691e-438f-8e14-974f1464b984/runs/dd4c8f6a-ee38-4f06-9174-5a88e6525123/workspace/open/src/hotspot/share/opto/compile.cpp:4003), pid=406338, tid=406353
#  assert(false) failed: malformed control flow
#
# JRE version: Java(TM) SE Runtime Environment (21.0+24) (fastdebug build 21-ea+24-LTS-2001)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-ea+24-LTS-2001, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x9092b8]  Compile::final_graph_reshaping()+0x11a8
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/741e9afd-8c02-45c3-b2e2-9db1450d0832-S108190/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/3abccbf0-b279-4e04-883e-dcf3bac90689/runs/ddf03d8d-dfe3-4a3e-91bb-bcdf6b5267b9/testoutput/test-support/jtreg_open_test_jdk_tier1/scratch/0_1/core.406338)
#
# An error report file with more information is saved as:
# /opt/mach5/mesos/work_dir/slaves/741e9afd-8c02-45c3-b2e2-9db1450d0832-S108190/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/3abccbf0-b279-4e04-883e-dcf3bac90689/runs/ddf03d8d-dfe3-4a3e-91bb-bcdf6b5267b9/testoutput/test-support/jtreg_open_test_jdk_tier1/scratch/0_1/hs_err_pid406338.log
[thread 407902 also had an error][thread 407824 also had an error][thread 407219 also had an error]


[thread 407823 also had an error]
[thread 407446 also had an error]
[thread 406359 also had an error]
[thread 409107 also had an error]
[thread 407411 also had an error]

------ Timeout during error reporting after 120 s. ------
# [ timer expired, abort... ]
----------System.err:(1085/85321)----------


Here's the crashing thread's stack:

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

Current thread (0x0000ffffb43250f0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=406353, stack(0x0000ffff9c5da000,0x0000ffff9c7da000) (2048K)]


Current CompileTask:
C2:  30775 5948       4       java.util.stream.ForEachOps$ForEachTask::compute (183 bytes)

Stack: [0x0000ffff9c5da000,0x0000ffff9c7da000],  sp=0x0000ffff9c7d4a50,  free space=2026k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x9092b8]  Compile::final_graph_reshaping()+0x11a8  (compile.cpp:4003)
V  [libjvm.so+0x90a804]  Compile::Optimize()+0x14f0  (compile.cpp:2450)
V  [libjvm.so+0x90bddc]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1488  (compile.cpp:839)
V  [libjvm.so+0x762c48]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x328  (c2compiler.cpp:118)
V  [libjvm.so+0x917f44]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x974  (compileBroker.cpp:2265)
V  [libjvm.so+0x918a64]  CompileBroker::compiler_thread_loop()+0x590  (compileBroker.cpp:1944)
V  [libjvm.so+0xdacf7c]  JavaThread::thread_main_inner()+0xec  (javaThread.cpp:719)
V  [libjvm.so+0x15f9f94]  Thread::call_run()+0xb0  (thread.cpp:217)
V  [libjvm.so+0x1353fd0]  thread_native_entry(Thread*)+0x130  (os_linux.cpp:775)
C  [libpthread.so.0+0x7908]  start_thread+0x188
Comments
Thanks, Aleksey. I'll temporarily disable the assert with JDK-8317998 to reduce the noise in testing. We can re-enable it once the known issues are fixed.
12-10-2023

I added two more sightings in CTW runs: JDK-8317996, JDK-8317997.
12-10-2023

JDK-8313241 disabled the assert in JDK 21.
27-07-2023

> What will happen in product mode? Is this really a P4? In product, we will bail out from compilation. We changed this for debug only with JDK-8303951 to catch and fix these cases. Most of the failures that we find now are probably very old issues that were hidden due to the bailout.
03-07-2023

Here's the crashing thread's stack from the jdk-22+3-112-tier8 sighting: applications/javafuzzer/BigTest.java --------------- T H R E A D --------------- Current thread (0x0000ffffa43320e0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=2602569, stack(0x0000ffff7da06000,0x0000ffff7dc04000) (2040K)] Current CompileTask: C2: 362 9 % b 4 Test::mainTest @ 96 (511 bytes) Stack: [0x0000ffff7da06000,0x0000ffff7dc04000], sp=0x0000ffff7dbfee30, free space=2019k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x907580] Compile::final_graph_reshaping()+0x1180 (compile.cpp:3999) V [libjvm.so+0x9084c4] Compile::Optimize()+0xee4 (compile.cpp:2452) V [libjvm.so+0x909b9c] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x14ec (compile.cpp:844) V [libjvm.so+0x760748] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x328 (c2compiler.cpp:118) V [libjvm.so+0x915c54] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x974 (compileBroker.cpp:2265) V [libjvm.so+0x916774] CompileBroker::compiler_thread_loop()+0x590 (compileBroker.cpp:1944) V [libjvm.so+0xda79ac] JavaThread::thread_main_inner()+0xec (javaThread.cpp:719) V [libjvm.so+0x15f75d4] Thread::call_run()+0xb0 (thread.cpp:217) V [libjvm.so+0x13531d0] thread_native_entry(Thread*)+0x130 (os_linux.cpp:778) C [libpthread.so.0+0x7908] start_thread+0x188
20-06-2023

I'm turning this into an umbrella issue for all the "malformed control flow" assertion failures. [~dcubed] [~dholmes] you can link new failures with this assertion message to this bug and we'll take it from here. To not lose track of all the reported tests, I've created a dedicated branch where we collect all the found Java Fuzzer failures: https://github.com/chhagedorn/jdk/tree/malformed_control_flow/failures To run all tests, one can use the simple bash script: $ bash run.sh path/to/java There are currently a few open issues related to this assertion (JDK-8308504, JDK-8307927, JDK-8288981). When one of these bugs is resolved, we can rerun all the reported tests and delete those which are fixed. When all of them are fixed, we can investigate those which are still failing. This saves us the overhead to examine each new report which is most likely a duplicate of one of the currently existing bugs.
05-06-2023

ILW = Malformed graph assert with bailout in product, single fuzzer test, disable compilation of affected methods = MLM = P4
22-05-2023

There is currently one open "malformed control flow" bug (JDK-8307927) but that one is triggered with irreducible loops. So, these report are likely to be something else. Will try to trace back/reduce the found issues so far.
22-05-2023

Attached Test.java and reduced version Reduced.java: $ java -Xcomp -XX:CompileOnly=Test Test.java $ java -Xcomp -XX:CompileOnly=Reduced Reduced.java
22-05-2023