# Failure analysis
ConnectionGraph::find_inst_mem contains recursive calls that can lead to a native C++ stack overflow in some cases.
# Original description
The C2 crashes without hs_err generation.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/lmesnik/ws/jdk-jck/build/linux-x64/images/jdk/bin/java --enable-preview -'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd8678a4e74 in PhiNode::verify_adr_type (this=this@entry=0x7fd7daf45928, recursive=recursive@entry=true) at /home/lmesnik/ws/jdk-jck/open/src/hotspot/share/opto/cfgnode.cpp:1188
1188 if (VMError::is_error_reported()) return; // muzzle asserts when debugging an error
[Current thread is 1 (Thread 0x7fd84496d640 (LWP 605955))]
With instrumentation mentioned in comments:
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S9922/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/bb2a42a8-b515-4ca4-871f-d848b5f874f4/runs/4c895d9f-7833-4a7a-bd1d-cca0ad6bce55/workspace/open/src/hotspot/share/opto/cfgnode.cpp:1162), pid=947068, tid=947140
# assert(count < 1000) failed: Stack overflow
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-internal-2024-01-23-1116378.tobias.hartmann.jdk3)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-internal-2024-01-23-1116378.tobias.hartmann.jdk3, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x881018] check_for_stack_overflow() [clone .part.0]+0x28
#
Current CompileTask:
C2:62927 8732 b javax.swing.plaf.basic.BasicLookAndFeel::initComponentDefaults (14883 bytes)
Stack: [0x00007f34df8ff000,0x00007f34df9ff000], sp=0x00007f34df9c7b80, free space=802k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x881018] check_for_stack_overflow() [clone .part.0]+0x28 (cfgnode.cpp:1162)
V [libjvm.so+0x886150] PhiNode::slice_memory(TypePtr const*) const+0x0
V [libjvm.so+0x894636] PhiNode::adr_type() const+0x16
V [libjvm.so+0x138b6be] MergeMemNode::memory_at(unsigned int) const+0x2de
V [libjvm.so+0xbb58c7] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0x327
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8
V [libjvm.so+0xbb5fb9] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0xa19
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8
V [libjvm.so+0xbb5fb9] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0xa19
V [libjvm.so+0xbb592b] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0x38b
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8
V [libjvm.so+0xbb5fb9] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0xa19
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8
V [libjvm.so+0xbb5fb9] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0xa19
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8
V [libjvm.so+0xbb5fb9] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0xa19
V [libjvm.so+0xbb592b] ConnectionGraph::find_inst_mem(Node*, int, GrowableArray<PhiNode*>&)+0x38b
V [libjvm.so+0xbb6508] ConnectionGraph::split_memory_phi(PhiNode*, int, GrowableArray<PhiNode*>&)+0x1e8