JDK-8367475 : Incorrect lock usage in LambdaFormInvokers::regenerate_holder_classes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-09-11
  • Updated: 2025-09-15
  • Resolved: 2025-09-13
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.
JDK 26
26 masterFixed
Related Reports
Relates :  
Description
In internal testing, we see an infrequent intermittent assert because we attempt to allocate Java objects while holding a mutex:

https://github.com/openjdk/jdk/blob/e172e6a4e37cf06afee662625a01193f5528a2b1/src/hotspot/share/cds/lambdaFormInvokers.cpp#L134

    MutexLocker ml(Thread::current(), LambdaFormInvokers_lock);
    list_lines = oopFactory::new_objArray_handle(vmClasses::String_klass(), len, CHECK);
    for (int i = 0; i < len; i++) {
      Handle h_line = java_lang_String::create_from_str(_lambdaform_lines->at(i), CHECK);

==============
# Internal Error (src/hotspot/share/runtime/interfaceSupport.inline.hpp:187), pid=1496008, tid=1496012
# assert(!thread->owns_locks()) failed: must release all locks when leaving VM

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x13fbea0] JvmtiJavaThreadEventTransition::JvmtiJavaThreadEventTransition(JavaThread*)+0x130 (interfaceSupport.inline.hpp:187)
V [libjvm.so+0x13f3a9b] JvmtiExport::post_sampled_object_alloc(JavaThread*, oop)+0x24b
V [libjvm.so+0x13f9ce7] JvmtiObjectAllocEventCollector::generate_call_for_allocated() [clone .part.0]+0x137
V [libjvm.so+0x13fa35a] JvmtiSampledObjectAllocEventCollector::~JvmtiSampledObjectAllocEventCollector()+0x2a
V [libjvm.so+0x1616e46] MemAllocator::Allocation::notify_allocation_jvmti_sampler()+0x466
V [libjvm.so+0x1619780] MemAllocator::allocate() const+0x2f0
V [libjvm.so+0x1b5befe] TypeArrayKlass::allocate_common(int, bool, JavaThread*)+0x13e
V [libjvm.so+0x175b069] oopFactory::new_byteArray(int, JavaThread*)+0x39
V [libjvm.so+0x108c32c] java_lang_String::basic_create(int, bool, JavaThread*)+0x1ec
V [libjvm.so+0x1092d49] java_lang_String::create_from_str(char const*, JavaThread*) [clone .part.0]+0x59
V [libjvm.so+0x145a36f] LambdaFormInvokers::regenerate_holder_classes(JavaThread*)+0x32f
V [libjvm.so+0x166df7e] MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder&, JavaThread*)+0x33e
V [libjvm.so+0x166e74c] MetaspaceShared::preload_and_dump(JavaThread*)+0x21c
V [libjvm.so+0x1066718] before_exit(JavaThread*, bool)+0x718
V [libjvm.so+0x1222e1b] JVM_Halt+0x8b
j java.lang.Shutdown.halt0(I)V+0 java.base@26-ea
j java.lang.Shutdown.halt(I)V+7 java.base@26-ea
j java.lang.Shutdown.exit(I)V+16 java.base@26-ea
j java.lang.Runtime.exit(I)V+1 java.base@26-ea
j java.lang.System.exit(I)V+4 java.base@26-ea
j javasoft.sqe.tests.vm.jvmti.soae001.soae00101.soae00101.main([Ljava/lang/String;)V+28
v ~StubRoutines::call_stub 0x00007f18a3c4f6fd
V [libjvm.so+0x106b2d7] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4f7
V [libjvm.so+0x11e9ab0] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*) [clone .constprop.1]+0x420
V [libjvm.so+0x11edaa4] jni_CallStaticVoidMethod+0x214
C [libjli.so+0x3c1a] invokeStaticMainWithArgs+0x4a
C [libjli.so+0x4cf8] JavaMain+0xf08
C [libjli.so+0x8099] ThreadJavaMain+0x9
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j java.lang.Shutdown.halt0(I)V+0 java.base@26-ea
j java.lang.Shutdown.halt(I)V+7 java.base@26-ea
j java.lang.Shutdown.exit(I)V+16 java.base@26-ea
j java.lang.Runtime.exit(I)V+1 java.base@26-ea
j java.lang.System.exit(I)V+4 java.base@26-ea
j javasoft.sqe.tests.vm.jvmti.soae001.soae00101.soae00101.main([Ljava/lang/String;)V+28
v ~StubRoutines::call_stub 0x00007f18a3c4f6fd
Comments
Looks to be that way since the original JDK-8266764? Linking that one up.
15-09-2025

Changeset: c85c5cb5 Branch: master Author: Ioi Lam <iklam@openjdk.org> Date: 2025-09-13 20:43:40 +0000 URL: https://git.openjdk.org/jdk/commit/c85c5cb50e0bd80732af9d45c85fc01032ed332c
13-09-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/27231 Date: 2025-09-11 17:22:20 +0000
11-09-2025