Skip to content

SIGSEGV in Method::validate_jmethod_id when using Temurin 26 on Alpine Linux with -Xcheck:jni #1437

@markus-gaisbauer-dt

Description

@markus-gaisbauer-dt

Please provide a brief summary of the bug

We observed JVM crashes in Method::validate_jmethod_id with Temurin 26 on Alpine Linux v3.23 (amd64 and aarch64):

The following is an excerpt of a hs_err_pid file for a crash on aarch64:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000ffff89474e0c, pid=16191, tid=16212
#
# JRE version: OpenJDK Runtime Environment Temurin-26+35 (26.0+35) (build 26+35)
# Java VM: OpenJDK 64-Bit Server VM Temurin-26+35 (26+35, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0xc74e0c]  Method::validate_jmethod_id(_jmethodID*)+0x4c
#
# Core dump will be written. Default location: Determined by the following: "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (alternatively, falling back to .../core.16191)
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
#

---------------  S U M M A R Y ------------

Command Line: -agentpath:liboneagentjava.so -Xcheck:jni -Xmx256m TestApp

Host: AArch64, 16 cores, 58G, Alpine Linux v3.23
Time: Wed Apr  8 10:53:09 2026 UTC elapsed time: 0.280455 seconds (0d 0h 0m 0s)

---------------  T H R E A D  ---------------

Current thread (0x0000ffff7d27f940):  JavaThread "oneagent***" daemon [_thread_in_vm, id=16212, stack(0x0000ffff7ca4e000,0x0000ffff7cb4c740) (1017K)]

Stack: [0x0000ffff7ca4e000,0x0000ffff7cb4c740],  sp=0x0000ffff7cb4bfa0,  free space=1015k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xc74e0c]  Method::validate_jmethod_id(_jmethodID*)+0x4c
V  [libjvm.so+0x9de2a8]  jniCheck::validate_call(JavaThread*, _jclass*, _jmethodID*, _jobject*) [clone .constprop.1]+0x34
V  [libjvm.so+0x9e0d4c]  checked_jni_CallStaticVoidMethodV+0x88
C  [liboneagentjava.so+0x2346b8]

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000ffff62b29470

The three libjvm.so offsets 0xc74e0c, 0x9de2a8 and 0x9e0d4c were resolved using addr2line -f -C -s -i -e libjvm.debuginfo with debug symbols available here:

Symbol Source
GrowableArrayView<_jmethodID*>::contains(_jmethodID* const&) const growableArray.hpp:193
Method::validate_jmethod_id(_jmethodID*) method.cpp:2135
jniCheck::validate_jmethod_id(JavaThread*, _jmethodID*) jniCheck.cpp:489
jniCheck::validate_call(JavaThread*, _jclass*, _jmethodID*, _jobject*) jniCheck.cpp:562
ThreadStateTransition::transition_from_vm(JavaThread*, JavaThreadState, bool) interfaceSupport.inline.hpp:121 (discriminator 11)
ThreadStateTransition::transition_from_vm(JavaThread*, JavaThreadState, bool) interfaceSupport.inline.hpp:110 (discriminator 11)
ThreadInVMfromNative::~ThreadInVMfromNative() interfaceSupport.inline.hpp:179 (discriminator 11)
checked_jni_CallStaticVoidMethodV jniCheck.cpp:1369 (discriminator 11)

The code in method.cpp:2135 was introduced with commit 8268406: Deallocate jmethodID native memory.

Conditions contributing the crash:

  • A JVMTI agent which uses JNI API to call Java methods reflectively
  • JVM is launched with command line option -Xcheck:jni

The crash is not easy to reproduce but occurred multiple times soon after JVM startup in our internal testing of the JVM (~10 times in the last 2 weeks). So far we noticed crashes when agent code tried to call java.lang.Thread#getThreadId, java.lang.Module#getName, and agent classes in bootstrap classpath.

Did you test with the latest update version?

  • Yes

Please provide steps to reproduce where possible

No response

Expected Results

No crash

Actual Results

Crash

What Java Version are you using?

OpenJDK 64-Bit Server VM Temurin-26+35 (26+35, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)

What is your operating system and platform?

No response

How did you install Java?

No response

Did it work before?

Did you test with other Java versions?

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjbs:reportedSomeone from our org has reported it to OpenJDK

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions