8207334: VM times out in VM_HandshakeAllThreads::doit() with RunThese30M
authorrehn
Fri, 17 Aug 2018 13:38:19 +0200
changeset 51432 90024ea291b4
parent 51431 0bdce38fde83
child 51433 f4e9ab292c90
8207334: VM times out in VM_HandshakeAllThreads::doit() with RunThese30M Summary: Handshakes did not consider external suspended threads safe for safepoint. Reviewed-by: dcubed, dholmes
src/hotspot/share/runtime/handshake.cpp
--- a/src/hotspot/share/runtime/handshake.cpp	Fri Aug 17 03:59:20 2018 -0700
+++ b/src/hotspot/share/runtime/handshake.cpp	Fri Aug 17 13:38:19 2018 +0200
@@ -338,7 +338,13 @@
 }
 
 bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
-  return SafepointSynchronize::safepoint_safe(target, target->thread_state());
+  // SafepointSynchronize::safepoint_safe() does not consider an externally
+  // suspended thread to be safe. However, this function must be called with
+  // the Threads_lock held so an externally suspended thread cannot be
+  // resumed thus it is safe.
+  assert(Threads_lock->owned_by_self(), "Not holding Threads_lock.");
+  return SafepointSynchronize::safepoint_safe(target, target->thread_state()) ||
+         target->is_ext_suspended();
 }
 
 bool HandshakeState::claim_handshake_for_vmthread() {