JDK-8358254 : runtime/cds/appcds/applications/JavacBench.java#aot crashes with SEGV in c2v_getFailedSpeculations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2025-06-01
  • Updated: 2025-06-01
Description
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000ffffa71a6fa8, pid=1331635, tid=1331650
#
# JRE version: Java(TM) SE Runtime Environment (25.0+26) (fastdebug build 25-ea+26-LTS-3170)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+26-LTS-3170, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x100cfa8]  c2v_getFailedSpeculations(JNIEnv_*, _jobject*, long, _jobjectArray*)+0x1a8


Current thread (0x0000ffffa01fdc40):  JavaThread "JVMCI-native CompilerThread0" daemon [_thread_in_vm, id=1331650, stack(0x0000fffea7203000,0x0000fffea75ff000) (4080K)]


Current CompileTask:
JVMCI-native:1780  376       4       java.util.concurrent.ConcurrentHashMap::get (162 bytes)

Stack: [0x0000fffea7203000,0x0000fffea75ff000],  sp=0x0000fffea75fc1c0,  free space=4068k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x100cfa8]  c2v_getFailedSpeculations(JNIEnv_*, _jobject*, long, _jobjectArray*)+0x1a8  (methodData.hpp:1978)
C  [libjvmcicompiler.so+0x18b77a8]  byte[][]* LibGraalClassLoader_75d3a5e0::jdk.vm.ci.hotspot.CompilerToVM::getFailedSpeculations(long, byte[][]*)+0xb8
C  [libjvmcicompiler.so+0x1919a60]  void LibGraalClassLoader_75d3a5e0::jdk.vm.ci.hotspot.HotSpotSpeculationLog::collectFailedSpeculations()+0x90
C  [libjvmcicompiler.so+0xe2da20]  LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.nodes.StructuredGraph* LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.hotspot.HotSpotGraalCompiler::createGraph(LibGraalClassLoader_75d3a5e0::jdk.vm.ci.meta.ResolvedJavaMethod*, int, LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.nodes.spi.ProfileProvider*, LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.core.common.CompilationIdentifier*, LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.options.OptionValues*, LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.debug.DebugContext*)+0x180
C  [libjvmcicompiler.so+0xdfaa58]  LibGraalClassLoader_75d3a5e0::jdk.vm.ci.hotspot.HotSpotCompilationRequestResult* LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.hotspot.CompilationTask$HotSpotCompilationWrapper::performCompilation(LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.debug.DebugContext*)+0x1f8
C  [libjvmcicompiler.so+0xdfa830]  java.lang.Object* LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.hotspot.CompilationTask$HotSpotCompilationWrapper::performCompilation(LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.debug.DebugContext*)+0x20
C  [libjvmcicompiler.so+0xc708f8]  java.lang.Object* LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.core.CompilationWrapper::run(LibGraalClassLoader_75d3a5e0::jdk.graal.compiler.debug.DebugContext*)+0x78

Comments
Is there some way that AOT recording may leave MethodData::_failed_speculations with an invalid value?
01-06-2025

Running runtime/cds/appcds/applications/JavacBench.java with TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseGraalJIT -XX:-TieredCompilation" seems to reliably crash with a slightly different stack: Stack: [0x000000016f370000,0x000000016f773000], sp=0x000000016f770e30, free space=4099k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0x49f208] ClassLoaderData::holder() const+0x10 V [libjvm.dylib+0xa899a8] JVMCIKlassHandle::operator=(Klass*)+0x30 V [libjvm.dylib+0xa8e3d0] c2v_getResolvedJavaType0(JNIEnv_*, _jobject*, _jobject*, long, unsigned char)+0x7b4 C [libjvmcicompiler.dylib+0x164d984] CompilerToVM_getResolvedJavaType0_J3OvZ9VBuu8b3nwBpuRy7I+0xc4 C [libjvmcicompiler.dylib+0x1682ddc] HotSpotMethodData$AbstractTypeData_getRawTypeProfile_7g0hLK7a9dBdm2KF7RNkcB+0x20c C [libjvmcicompiler.dylib+0x168332c] HotSpotMethodData$AbstractTypeData_getTypeProfile_F1wZkHaTQnK4nYAMPyXalF+0x7c C [libjvmcicompiler.dylib+0x1694680] HotSpotProfilingInfoImpl_getTypeProfile_uP0vW2cgmMDMzhso7A9eK7+0x80 C [libjvmcicompiler.dylib+0x1143378] ableProfileProvider$CachingProfilingInfo_getTypeProfile_Cb3KP2uWrzJb0nCryRKdtJ+0x108 C [libjvmcicompiler.dylib+0xd1f62c] BytecodeParser_getProfileForInvoke_8q3bf9xLrd4npuoZFb9f68+0xec C [libjvmcicompiler.dylib+0xcfd5a8] BytecodeParser_appendInvoke_fA8XarzuM5Jhdeg5JRAfq0+0x808 C [libjvmcicompiler.dylib+0xd0db24] BytecodeParser_genDynamicInvokeHelper_Q2pLuS2gss2YSHagERJdh2+0x134 C [libjvmcicompiler.dylib+0xd14398] BytecodeParser_genInvokeVirtual_6ddu9vkYC7KQiKgwPDOoLB+0x78
01-06-2025