Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8367475

Incorrect lock usage in LambdaFormInvokers::regenerate_holder_classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • 17, 21, 25
    • hotspot
    • master

      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

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: