8207334: VM times out in VM_HandshakeAllThreads::doit() with RunThese30M

Handshakes did not consider external suspended threads safe for safepoint.

Reviewed-by: dcubed, dholmes
This commit is contained in:
Robbin Ehn 2018-08-17 13:38:19 +02:00
parent 3c0f0f0175
commit 3bb71a9b51

View File

@ -338,7 +338,13 @@ void HandshakeState::cancel_inner(JavaThread* thread) {
}
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() {