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

JvmtiEnvBase::get_current_contended_monitor fails "assert(thread == nullptr || thread == Thread::current() || SafepointSynchronize::is_at_safepoint()) failed: sanity check"

XMLWordPrintable

    • x86_64
    • linux

      The following test failed in the JDK22 CI:

      vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/TestDescription.java

      Here's a snippet from the log file:

      #section:main
      ----------messages:(6/364)----------
      command: main -agentlib:cm01t005=-waittime=5 nsk.jvmti.scenarios.capability.CM01.cm01t005
      reason: User specified action: run main/othervm/native -agentlib:cm01t005=-waittime=5 nsk.jvmti.scenarios.capability.CM01.cm01t005
      started: Sat Dec 02 21:20:58 UTC 2023
      Mode: othervm [/othervm specified]
      finished: Sat Dec 02 21:21:07 UTC 2023
      elapsed time (seconds): 8.795
      ----------configuration:(0/0)----------
      ----------System.out:(19/1837)----------
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/afbc6042-3a24-4198-9369-18c663a3f74c-S33989/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/791158c1-9534-40c4-9f8e-2e922cc92b47/runs/bfd20001-db3d-4d13-9107-87c5b68d0064/workspace/open/src/hotspot/share/runtime/jniHandles.cpp:321), pid=2151681, tid=2151701
      # assert(thread == nullptr || thread == Thread::current() || SafepointSynchronize::is_at_safepoint()) failed: sanity check
      #
      # JRE version: Java(TM) SE Runtime Environment (22.0+27) (fastdebug build 22-ea+27-2168)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+27-2168, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xfd7e3c] JNIHandleBlock::allocate_block(JavaThread*, AllocFailStrategy::AllocFailEnum)+0x13c
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10016/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2975cc13-196b-434d-ae21-3b6d1f83a56b/runs/7fb69349-8c1e-44ee-b957-afd7ba2ac1b7/testoutput/test-support/jtreg_open_test_hotspot_jtreg_vmTestbase_nsk_jvmti/scratch/0/core.2151681)
      #
      # An error report file with more information is saved as:
      # /opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10016/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2975cc13-196b-434d-ae21-3b6d1f83a56b/runs/7fb69349-8c1e-44ee-b957-afd7ba2ac1b7/testoutput/test-support/jtreg_open_test_hotspot_jtreg_vmTestbase_nsk_jvmti/scratch/0/hs_err_pid2151681.log
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #
      ----------System.err:(0/0)----------
      ----------rerun:(38/9175)*----------


      Here are snippets from the hs_err_pid file:

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

      Current thread (0x00007f9aac0200b0): VMThread "VM Thread" [id=2151701, stack(0x00007f9a945de000,0x00007f9a946de000) (1024K)] _threads_hazard_ptr=0x00007f99fc01cd30, _nested_threads_hazard_ptr_cnt=0

      Stack: [0x00007f9a945de000,0x00007f9a946de000], sp=0x00007f9a946dc4e0, free space=1017k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xfd7e3c] JNIHandleBlock::allocate_block(JavaThread*, AllocFailStrategy::AllocFailEnum)+0x13c (jniHandles.cpp:321)
      V [libjvm.so+0xfd8606] JNIHandleBlock::allocate_handle(JavaThread*, oop, AllocFailStrategy::AllocFailEnum)+0x2f6 (jniHandles.cpp:475)
      V [libjvm.so+0xfd8598] JNIHandleBlock::allocate_handle(JavaThread*, oop, AllocFailStrategy::AllocFailEnum)+0x288 (jniHandles.cpp:482)
      V [libjvm.so+0xfd871e] JNIHandles::make_local(JavaThread*, oop, AllocFailStrategy::AllocFailEnum)+0x7e (jniHandles.cpp:70)
      V [libjvm.so+0x116e04c] JvmtiEnvBase::jni_reference(JavaThread*, Handle)+0x3c (jvmtiEnvBase.cpp:527)
      V [libjvm.so+0x11711be] JvmtiEnvBase::get_current_contended_monitor(JavaThread*, JavaThread*, _jobject**, bool)+0x15e (jvmtiEnvBase.cpp:948)
      V [libjvm.so+0x1171523] GetCurrentContendedMonitorClosure::do_thread(Thread*)+0x93 (jvmtiEnvBase.cpp:2458)
      V [libjvm.so+0xd9caa7] HandshakeOperation::do_handshake(JavaThread*)+0x47 (handshake.cpp:326)
      V [libjvm.so+0xd9d06a] HandshakeState::try_process(HandshakeOperation*) [clone .part.0]+0xfa (handshake.cpp:671)
      V [libjvm.so+0xd9f4bf] VM_HandshakeAllThreads::doit()+0x57f (handshake.cpp:651)
      V [libjvm.so+0x186ed45] VM_Operation::evaluate()+0xf5 (vmOperations.cpp:73)
      V [libjvm.so+0x1890857] VMThread::evaluate_operation(VM_Operation*)+0xc7 (vmThread.cpp:281)
      V [libjvm.so+0x18910d0] VMThread::inner_execute(VM_Operation*)+0x200 (vmThread.cpp:435)
      V [libjvm.so+0x1891474] VMThread::loop()+0x84 (vmThread.cpp:502)
      V [libjvm.so+0x1891584] VMThread::run()+0x94 (vmThread.cpp:175)
      V [libjvm.so+0x178cbe6] Thread::call_run()+0xb6 (thread.cpp:220)
      V [libjvm.so+0x1496e57] thread_native_entry(Thread*)+0x127 (os_linux.cpp:787)

      <snip>

      VM_Operation (0x00007f9a85bf8e70): HandshakeAllThreads, mode: no safepoint, requested by thread 0x00007f9aac3994f0

      <snip>

      VM state: not at safepoint (normal execution)

      Update: The JavaThread that requested the VM operation is: 0x00007f9aac3994f0
        0x00007f9aac3994f0 JavaThread "UsageTracker" daemon [_thread_blocked, id=2151738, stack(0x00007f9a85afc000,0x00007f9a85bfc000) (1024K)]

      And for some reason that thread is on both of these lists:

      Threads class SMR info:
      _java_thread_list=0x00007f99fc01cd30, length=15, elements={
      0x00007f9aac0441f0, 0x00007f9aac366270, 0x00007f9aac367b90, 0x00007f9aac369c20,
      0x00007f9aac36b580, 0x00007f9aac36cda0, 0x00007f9aac36eb70, 0x00007f9aac370540,
      0x00007f9aac3900a0, 0x00007f9aac395d70, 0x00007f9aac3994f0, 0x00007f9aac3c8260,
      0x00007f99fc01ef50, 0x00007f99fc032760, 0x00007f99fc0339b0
      }
      _to_delete_list=0x00007f99fc0326f0, length=14, elements={
      0x00007f9aac0441f0, 0x00007f9aac366270, 0x00007f9aac367b90, 0x00007f9aac369c20,
      0x00007f9aac36b580, 0x00007f9aac36cda0, 0x00007f9aac36eb70, 0x00007f9aac370540,
      0x00007f9aac3900a0, 0x00007f9aac395d70, 0x00007f9aac3994f0, 0x00007f9aac3c8260,
      0x00007f99fc01ef50, 0x00007f99fc032760
      }

            sspitsyn Serguei Spitsyn
            dcubed Daniel Daugherty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: