8219584: Try to dump error file by thread which causes safepoint timeout

Reviewed-by: stuefe, dholmes, kvn
This commit is contained in:
Martin Doerr 2019-03-08 11:23:30 +01:00
parent cafb914cca
commit 97ec4aeed2
7 changed files with 151 additions and 3 deletions

View file

@ -902,6 +902,16 @@ void SafepointSynchronize::print_safepoint_timeout() {
// To debug the long safepoint, specify both AbortVMOnSafepointTimeout &
// ShowMessageBoxOnError.
if (AbortVMOnSafepointTimeout) {
// Send the blocking thread a signal to terminate and write an error file.
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur_thread = jtiwh.next(); ) {
if (cur_thread->safepoint_state()->is_running()) {
if (!os::signal_thread(cur_thread, SIGILL, "blocking a safepoint")) {
break; // Could not send signal. Report fatal error.
}
// Give cur_thread a chance to report the error and terminate the VM.
os::sleep(Thread::current(), 3000, false);
}
}
fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.",
SafepointTimeoutDelay, VMThread::vm_operation()->name());
}