JDK-8340214 : C2 compilation asserts with "no node with a side effect" in PhaseIdealLoop::try_sink_out_of_loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,23,24
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2024-09-13
  • Updated: 2024-11-04
  • Resolved: 2024-10-09
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 JDK 24
21.0.6-oracleFixed 23.0.2Fixed 24 b19Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
OpenJDK 64-Bit Server VM (fastdebug 21.0.5+5-Nightly) for linux-amd64
Redhat 8.9

A DESCRIPTION OF THE PROBLEM :
While we were upgrading from java 8 to java 21, we encountered an issue where some of the files that our code writes were corrupted. We traced that to a small method that transfers bytes from an Unsafe based Buffer to java.nioByteBuffer. This was happening right after the method got compiled by C2. We believe that after inlining and loop optimizations, the generated code is incorrect (the update positionAddress instruction was likely moved out of the loop). I think we've confirmed that when we got a crash report by using a fastdebug build of the Java21.

REGRESSION : Last worked in version 8u421

ACTUAL -
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/jenkins/node/workspace/Corretto21/generic_linux/x64/build/Corretto21Src/installers/linux/universal/tar/corretto-build/buildRoot/src/hotspot/share/opto/loopopts.cpp:1643), pid=3104989, tid=3105002
# assert(!n->is_Store() && !n->is_LoadStore()) failed: no node with a side effect
#
# JRE version: OpenJDK Runtime Environment Corretto-21.0.5.5.1 (21.0.5+5) (fastdebug build 21.0.5+5-Nightly)
# Java VM: OpenJDK 64-Bit Server VM Corretto-21.0.5.5.1 (fastdebug 21.0.5+5-Nightly, mixed mode, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x11fb779] PhaseIdealLoop::try_sink_out_of_loop(Node*)+0xc89
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e" (or dumping to xxx/core.3104989)
#
# If you would like to submit a bug report, please visit:
# https://github.com/corretto/corretto-21/issues/
#

---------- BEGIN SOURCE ----------
I haven't been able to create a small reproducer that doesn't use any of our internal code yet. The bug is pretty subtle. I am hoping that the hs_err report file could give us more insight into when it happens so that I can make a small executable test case. Is there any easy way to produce this, perhaps using the compiler replay functionality?
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Using either -XX:-SplitIfBlocks or -XX:CompileCommand=exclude,methodname

We also rewrote the code in a slightly different way so it no longer happens.


FREQUENCY : always 
Comments
Fix request [21u] I backport this for parity with 21.0.6-oracle. Low to medium risk, small change but typical C2 risk. We should fix it due to good reproducability. Clean backport. Test passes and reproduces the issue without the fix. SAP nightly testing passed.
02-11-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1117 Date: 2024-10-31 20:24:19 +0000
31-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk23u/pull/161 Date: 2024-10-14 09:13:47 +0000
14-10-2024

[jdk23u-fix-request] Critical, customer reported issue leading to incorrect execution / file corruption. Fix is medium risk. Applies cleanly. Tier1-3 passed.
14-10-2024

Changeset: ff2f39f2 Branch: master Author: Roland Westrelin <roland@openjdk.org> Date: 2024-10-09 14:59:15 +0000 URL: https://git.openjdk.org/jdk/commit/ff2f39f24018436556a8956ec55da433dc697437
09-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21303 Date: 2024-10-02 11:21:43 +0000
02-10-2024

Mail from submitter =============== Thanks for your email. I did spend more time on this and managed to create a standalone reproducible testcase. Please see attached file. I've used the command below to start it. "~/XX/java/amazon-corretto-21.0.5.5.1-linux-x64-fastdebug/bin/java -XX:+UseParallelGC -XX:-TieredCompilation -XX:+PrintCompilation -XX:-BackgroundCompilation UnsafeTestOsm2.java" The crash doesn't happen with a non fastdebug build version. However, I believe the C2 Compiler generates incorrect code that corrupts the file we were writing to.
25-09-2024

Triggers first after JDK-8297933 in JDK 21 b05. Roland, could you please have a look?
18-09-2024

Perfect, I can reproduce the issue now. Investigating.
18-09-2024

Resolving as Incomplete until we get more information.
17-09-2024

Regarding reproducing this with compiler replay: We would need the replay_pid*.log file + all the class files that are needed to replay the compilation. The reporter can check if the issue reproduces with: java XX:+ReplayCompiles -XX:+ReplayIgnoreInitErrors -XX:ReplayDataFile=replay_pid.log -XX:-CompactStrings -XX:+UseParallelGC -XX:-TieredCompilation -cp CLASSPATH It would also help to get more information about the affected JDK releases.
17-09-2024

[~fmatte] JDK-8294967 -> JDK-8288981 does not affect release builds and must therefore be a different issue. It's most likely another regression from JDK-8252372 in JDK 17 that had a huge bug tail. Unfortunately, there is not much we can do without a reproducer. It might be related to JDK-8336472 or one of the other bugs related to JDK-8252372 that we still have open.
17-09-2024

Similar one of JDK-8288981
16-09-2024