JDK-8361699 : assert(can_reduce_phi(n->as_Phi())) failed
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 26
  • Priority: P3
  • Status: New
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2025-07-08
  • Updated: 2025-07-09
Description
ADDITIONAL SYSTEM INFORMATION :
$java -version
openjdk version "26-internal" 2026-03-17
OpenJDK Runtime Environment (fastdebug build 26-internal-adhoc.user.jdk-mainline)
OpenJDK 64-Bit Server VM (fastdebug build 26-internal-adhoc.user.jdk-mainline, mixed mode)

A DESCRIPTION OF THE PROBLEM :
We encountered the problem of jdk crash when running the following code using the jdk compiled from the source code obtained from the github jdk repository.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (**src/hotspot/share/opto/escape.cpp:384), pid=1780742, tid=1780782
#  assert(can_reduce_phi(n->as_Phi())) failed: Sanity: previous reducible Phi is no longer reducible before SUT.
#
# JRE version: OpenJDK Runtime Environment (26.0) (fastdebug build 26-internal-adhoc.user.jdk-mainline)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 26-internal-adhoc.user.jdk-mainline, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd66ffc]  ConnectionGraph::compute_escape()+0x243c
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -F%F -- %E" (or dumping to /data2/user/Artemis/toreport/8/reduce/core.1780742)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java 
java Test

ACTUAL -
 322  Proj  === 310  [[ 323 327 ]] #5 !jvms: Test$Ci::foo2 @ bci:42 (line 21)
 155  Proj  === 143  [[ 156 160 ]] #5 !jvms: Test$Ci::foo2 @ bci:15 (line 17)
 157  Proj  === 156  [[ 368 160 ]] #0 !orig=[211] !jvms: Test$Ci::foo2 @ bci:15 (line 17)
 324  Proj  === 323  [[ 337 327 ]] #0 !jvms: Test$Ci::foo2 @ bci:42 (line 21)
 294  Region  === 294 316 370  [[ 294 337 331 332 333 334 ]] #reducible  !jvms: Test$Ci::foo2 @ bci:49 (line 22)
 327  CheckCastPP  === 324 322  [[ 358 ]]  #byte[int:10] (java/lang/Cloneable,java/io/Serializable):NotNull:exact * !jvms: Test$Ci::foo2 @ bci:42 (line 21)
 160  CheckCastPP  === 157 155  [[ 358 292 310 ]]  #java/lang/Object:NotNull:exact *  Oop:java/lang/Object:NotNull:exact * !orig=[252],261 !jvms: Test$Ci::foo2 @ bci:15 (line 17)
 337  Region  === 337 294 324  [[ 337 361 347 358 349 350 351 352 353 354 ]] #reducible  !jvms: Test$Ci::foo2 @ bci:51 (line 25)
 358  Phi  === 337 160 327  [[ 361 ]]  #java/lang/Object:NotNull *  Oop:java/lang/Object:NotNull * !jvms: Test$Ci::foo2 @ bci:51 (line 25)
 358  Phi  === 337 160 327  [[ 361 ]]  #java/lang/Object:NotNull *  Oop:java/lang/Object:NotNull * !jvms: Test$Ci::foo2 @ bci:51 (line 25)
 361  CallStaticJava  === 337 347 307 8 9 (360 1 11 12 65 358 191 1 12 ) [[ 362 ]] # Static uncommon_trap(reason='uninitialized' action='reinterpret' debug_id='0')  void ( int ) C=0.000100 Test$Ci::foo2 @ bci:52 (line 25) !jvms: Test$Ci::foo2 @ bci:52 (line 25)
 362  Proj  === 361  [[ 365 ]] #0 !jvms: Test$Ci::foo2 @ bci:52 (line 25)
Can NOT reduce Phi 358 on invocation 0. No SR Allocate as input.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (**src/hotspot/share/opto/escape.cpp:384), pid=1860485, tid=1860499
#  assert(can_reduce_phi(n->as_Phi())) failed: Sanity: previous reducible Phi is no longer reducible before SUT.
#
# JRE version: OpenJDK Runtime Environment (26.0) (fastdebug build 26-internal-adhoc.user.jdk-mainline)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 26-internal-adhoc.user.jdk-mainline, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd5b88c]  ConnectionGraph::compute_escape()+0x243c
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -F%F -- %E" (or dumping to /data2/user/Artemis/toreport/8/reduce/core.1860485)
#
# An error report file with more information is saved as:
# /data2/user/Artemis/toreport/8/reduce/hs_err_pid1860485.log
#
# Compiler replay data is saved as:
# /data2/user/Artemis/toreport/8/reduce/replay_pid1860485.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#


---------- BEGIN SOURCE ----------
import java.util.zip.GZIPInputStream;

public class Test {
    abstract class Ci_abs {
        abstract void foo(int int1);
    }

    class Ci extends Ci_abs {
        @Override
        void foo(int int1) {
            GZIPInputStream gzipInputStream = null;
            foo2(int1, gzipInputStream);
        }

        void foo2(int i1, GZIPInputStream gzipInputStream) {
            Object[] objects = { new Object() };
            Object object = new Object();
            for (int i = -15; i < 1500000; i++) {
                try {
                    objects[i1] = object;
                    object = new byte[10];
                } catch (Throwable t) {
                }
                try {
                    gzipInputStream.read();
                } catch (Throwable t2) {
                }
            }
        }
    }

    public static void main(String[] args) {
        Test Test1 = new Test();
        Ci_abs Ci_abs1 = Test1.new Ci();
        int int1 = 498972445;
        Ci_abs1.foo(int1);
    }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
ILW = HLM = P3 Impact = High, due to crash, on default vm arguments. Likelihood - Low, not found so far and it is rare case. Workaround - Excluding the crashing method from compilation
09-07-2025