changeset 51432:90024ea291b4

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
author rehn
date Fri, 17 Aug 2018 13:38:19 +0200
parents 0bdce38fde83
children f4e9ab292c90
files src/hotspot/share/runtime/handshake.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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() {