Got the following assertion failure while running: vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/TestDescription.java
# Internal Error (t:/workspace/open/src/hotspot/share/runtime/mutexLocker.cpp:171), pid=8976, tid=19504
# fatal error: must own lock Threads_lock
JDK-8241043 introduced an assertion in Thread::stack_base() that calls Thread::name(). Thread::name() for a JavaThread calls JavaThread::get_thread_name, which requires safepoint or Threads_lock or handshake if called from other than the current JavaThread.
(This seems related to (or perhaps an actual occurrence of) the problem described in JDK-8241403.)
jvmti_GetObjectMonitorUsage reaches that point without that state, leading to the assertion failure.
Here's the stack trace from the hs_err file:
stack: [0x000000f524f10000,0x000000f525010000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x9d7881] os::platform_print_native_stack+0xf1 (os_windows_x86.cpp:369)
V [jvm.dll+0xbda9ab] VMError::report+0xf0b (vmerror.cpp:725)
V [jvm.dll+0xbdc25e] VMError::report_and_die+0x8ae (vmerror.cpp:1533)
V [jvm.dll+0xbdc954] VMError::report_and_die+0x64 (vmerror.cpp:1317)
V [jvm.dll+0x410210] report_fatal+0x80 (debug.cpp:286)
V [jvm.dll+0x98bdf6] assert_locked_or_safepoint_or_handshake+0xf6 (mutexlocker.cpp:193)
V [jvm.dll+0xb78ca5] JavaThread::get_thread_name+0x85 (thread.cpp:3155)
V [jvm.dll+0x17c37] Thread::stack_end+0x27 (thread.hpp:755)
V [jvm.dll+0xb79edb] JavaThread::is_lock_owned+0x2b (thread.cpp:2246)
V [jvm.dll+0xb7bd24] Threads::owning_thread_from_monitor_owner+0x74 (thread.cpp:4713)
V [jvm.dll+0x7e0fb3] JvmtiEnvBase::get_object_monitor_usage+0x1e3 (jvmtienvbase.cpp:996)
V [jvm.dll+0x7d81dc] JvmtiEnv::GetObjectMonitorUsage+0x4c (jvmtienv.cpp:2847)
V [jvm.dll+0x798440] jvmti_GetObjectMonitorUsage+0x130 (jvmtienter.cpp:4105)
C [objmonusage005.dll+0x1136]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j nsk.jvmti.GetObjectMonitorUsage.objmonusage005.check(Ljava/lang/Object;)V+0
j nsk.jvmti.GetObjectMonitorUsage.objmonusage005.run([Ljava/lang/String;Ljava/io/PrintStream;)I+31
j nsk.jvmti.GetObjectMonitorUsage.objmonusage005.main([Ljava/lang/String;)V+9
v ~StubRoutines::call_stub
j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@15-ea
j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@15-ea
j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@15-ea
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@15-ea
j com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j java.lang.Thread.run()V+11 java.base@15-ea
v ~StubRoutines::call_stub