JDK-8334809 : Spring Boot crashes with Leyden EA
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-leyden
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-06-24
  • Updated: 2024-06-28
  • Resolved: 2024-06-28
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.
Other
repo-leydenFixed
Related Reports
Relates :  
Relates :  
Description
From dreamlike.vertx@gmail.com

 I am writing to report an issue I encountered while using the new Leyden EA build for various tests. Specifically, when generating CDS (Class Data Sharing) files for a Spring Boot project on Linux x86_64, I encountered a core dump.

Here are the details:

Project repository: https://github.com/dreamlike-ocean/leydenPlayground (In the project root directory, you will find the corresponding core dump and logs related to this issue.)
Reproduction steps:

1,Navigate to the project root directory.
2,Execute the following build command:
 `mvn clean package -pl leyden-spring && java -XX:CacheDataStore=spring-leyden.cds -jar leyden-spring/target/leyden-spring-0.0.1.jar`

I appreciate your assistance in resolving this matter. Please let me know if you need any additional information.

use the following build toolchain:
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /home/dreamlike/.sdkman/candidates/maven/current
Java version: 24-leydenpremain, vendor: Oracle Corporation, runtime: /home/dreamlike/jdks/leyden-jdk-24
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "6.8.0-31-generic", arch: "amd64", family: "unix"
Comments
I pushed fixes pulled from mainline: c27385e3a9a JDK-8335221: Some C2 intrinsics incorrectly assume that type argument is compile-time constant 5b27856a66d JDK-8335220: C2: Missing check for Opaque4 node in EscapeAnalysis dc69d066e92 JDK-8334421: assert(!oldbox->is_unbalanced()) failed: this should not be called for unbalanced region
28-06-2024

2 issues we need to fix: 1). In Escape Analysis code assumes If node always has shape like: Node* curr_cmp = curr_ctrl->in(0)->in(1)->in(1); // true/false -> if -> bool -> cmp But we may have Opaque nodes in between: 1376 Opaque4 === _ 1908 753 [[ 738 ]] !jvms: ZipCentralDirectoryFileHeaderRecord::load @ bci:6 (line 195) 738 If === 1375 1376 [[ 470 1396 ]] P=0.999999, C=-1.000000 !jvms: ZipCentralDirectoryFileHeaderRecord::load @ bci:6 (line 195) 2) Intrinsic missing check result of java_mirror_type() which could be NULL if constant folding is off.
26-06-2024

> Probably, java.util.DualPivotQuicksort class is in some weird state (not-yet-loaded?). My bad, first argument is used to pass element type which is a mirror for a primitive: 27: getstatic #41 // Field java/lang/Integer.TYPE:Ljava/lang/Class; ... 43: invokestatic #56 // Method sort:(Ljava/lang/Class;Ljava/lang/Object;JIILjava/util/DualPivotQuicksort$SortOperation;)V Does the crash mean that Integer class is not initialized yet (java/lang/Integer.Type == null)?
26-06-2024

It tried to dereference a null: siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000010 Looks like the null corresponds to java.util.DualPivotQuicksort mirror: bool LibraryCallKit::inline_array_sort() { Node* elementType = null_check(argument(0)); ... const TypeInstPtr* elem_klass = gvn().type(elementType)->isa_instptr(); ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); Probably, java.util.DualPivotQuicksort class is in some weird state (not-yet-loaded?).
26-06-2024

-XX:CDSPreimage=spring-leyden.cds.preimage means we are running the forked VM during CDS and cached code artifacts generation.
26-06-2024

New failure: Command Line: -XX:CacheDataStore=spring-leyden.cds -XX:+UnlockDiagnosticVMOptions -XX:-ReduceAllocationMerges -XX:CDSPreimage=spring-leyden.cds.preimage [...] Current CompileTask: C2: F9296 C0 Q0 S4 3989 b 4 java.util.DualPivotQuicksort::sort (685 bytes) Stack: [0x0000731263600000,0x0000731263700000], sp=0x00007312636fc808, free space=1010k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x5f6e60] ciObject::get_oop() const+0x0 V [libjvm.so+0xbd9d7c] LibraryCallKit::inline_array_sort()+0xbc V [libjvm.so+0xbf042e] LibraryIntrinsic::generate(JVMState*)+0x15e V [libjvm.so+0x78dbe3] Parse::do_call()+0x203 V [libjvm.so+0xda1241] Parse::do_one_block()+0x1b1 V [libjvm.so+0xda18f5] Parse::do_all_blocks()+0xe5 V [libjvm.so+0xda334c] Parse::Parse(JVMState*, ciMethod*, float)+0x69c V [libjvm.so+0x5a2dab] ParseGenerator::generate(JVMState*)+0x8b V [libjvm.so+0x695be5] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xcf5
26-06-2024

After switching off Escape Analysis optimization we got new failure reported. Seems it is not related to EA but issue with accessing java mirrors for classes when C2 compiling during Leyden artifacts generation.
26-06-2024

[~kvn] feel free to assign the issue to me or let me know how else I can help!
24-06-2024

Work-around to try: -XX:+UnlockDiagnosticVMOptions -XX:-ReduceAllocationMerges
24-06-2024

Based on hs_err file it is related to Escape Analysis optimization done by [~cslucas]: Current CompileTask: C2: F5781 C0 Q0 S14 2561 b 4 org.springframework.boot.loader.jar.NestedJarFile::getVersionedContentEntry (98 bytes) Stack: [0x00007c88680a3000,0x00007c88681a3000], sp=0x00007c886819e0e0, free space=1004k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0xd3e349] Node::Node(Node*, Node*, Node*)+0x189 V [libjvm.so+0xef91de] CmpNode::make(Node*, Node*, BasicType, bool)+0x13e V [libjvm.so+0x7a13f8] ConnectionGraph::specialize_castpp(Node*, Node*, Node*)+0x48 V [libjvm.so+0x7a996e] ConnectionGraph::reduce_phi_on_castpp_field_load(Node*, GrowableArray<Node*>&, GrowableArray<Node*>&)+0x23e V [libjvm.so+0x7a9d1d] ConnectionGraph::reduce_phi(PhiNode*, GrowableArray<Node*>&, GrowableArray<Node*>&)+0x21d V [libjvm.so+0x7ae8c9] ConnectionGraph::split_unique_types(GrowableArray<Node*>&, GrowableArray<ArrayCopyNode*>&, GrowableArray<MergeMemNode*>&, Unique_Node_List&)+0x11b9 V [libjvm.so+0x7b10aa] ConnectionGraph::compute_escape()+0x162a V [libjvm.so+0x7b1251] ConnectionGraph::do_analysis(Compile*, PhaseIterGVN*)+0x101 V [libjvm.so+0x694be5] Compile::Optimize()+0xdb5 V [libjvm.so+0x695dbe] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xece May be we already have a bug for it.
24-06-2024