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
--- 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() {