8229778: TestJstatdDefaults.java failed due to "fatal error: LEAF method calling lock?"
authorrehn
Tue, 24 Sep 2019 08:54:39 +0200
changeset 58279 448fe2bfd505
parent 58278 e47b459b315c
child 58280 ef8c8cf9256a
8229778: TestJstatdDefaults.java failed due to "fatal error: LEAF method calling lock?" Reviewed-by: dholmes, dcubed
src/hotspot/share/runtime/thread.cpp
--- a/src/hotspot/share/runtime/thread.cpp	Mon Sep 23 19:55:26 2019 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Sep 24 08:54:39 2019 +0200
@@ -1803,7 +1803,10 @@
 void JavaThread::block_if_vm_exited() {
   if (_terminated == _vm_exited) {
     // _vm_exited is set at safepoint, and Threads_lock is never released
-    // we will block here forever
+    // we will block here forever.
+    // Here we can be doing a jump from a safe state to an unsafe state without
+    // proper transition, but it happens after the final safepoint has begun.
+    set_thread_state(_thread_in_vm);
     Threads_lock->lock();
     ShouldNotReachHere();
   }