Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8288556: VM crashes if it gets sent SIGUSR2 from outside #9181

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/hotspot/os/posix/signals_posix.cpp
Expand Up @@ -1597,7 +1597,22 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
PosixSignals::unblock_error_signals();

Thread* thread = Thread::current_or_null_safe();
assert(thread != NULL, "Missing current thread in SR_handler");

// The suspend/resume signal may have been sent from outside the process, deliberately or
// accidentally. In that case the receiving thread may not be attached to the VM. We handle
// that case by asserting (debug VM) resp. writing a diagnostic message to tty and
// otherwise ignoring the stray signal (release VMs).
// We print the siginfo as part of the diagnostics, which also contains the sender pid of
// the stray signal.
if (thread == nullptr) {
stringStream ss;
ss.print_raw("Non-attached thread received stray SR signal (");
os::print_siginfo(&ss, siginfo);
ss.print_raw(").");
assert(thread != NULL, "%s.", ss.base());
log_warning(os)("%s", ss.base());
return;
}

// On some systems we have seen signal delivery get "stuck" until the signal
// mask is changed as part of thread termination. Check that the current thread
Expand Down