Skip to content

Commit f0add88

Browse files
author
David Holmes
committed
8373837: "assert(thread->is_VM_thread() || thread->is_Java_thread()) failed: Must be VMThread or JavaThread" on macosx-aarch64-26
Reviewed-by: fbredberg, coleenp
1 parent 6231646 commit f0add88

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/hotspot/os/posix/signals_posix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,21 +1669,21 @@ static void SR_handler(int sig, siginfo_t* siginfo, void* context) {
16691669

16701670
// On some systems we have seen signal delivery get "stuck" until the signal
16711671
// mask is changed as part of thread termination. Check that the current thread
1672-
// has not already terminated - else the following assertion
1673-
// will fail because the thread is no longer a JavaThread as the ~JavaThread
1674-
// destructor has completed.
1675-
1672+
// has not already terminated, else the osthread may already have been freed.
16761673
if (thread->has_terminated()) {
16771674
return;
16781675
}
16791676

1680-
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
1681-
16821677
OSThread* osthread = thread->osthread();
16831678

16841679
SuspendResume::State current = osthread->sr.state();
16851680

16861681
if (current == SuspendResume::SR_SUSPEND_REQUEST) {
1682+
// Only check this on an active suspend request. It is possible to get a late delivered
1683+
// signal from a cancelled suspend request that hits after the JavaThread destructor
1684+
// completes, but before the Thread destructor causes `is_terminated()` to be true.
1685+
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
1686+
16871687
suspend_save_context(osthread, siginfo, context);
16881688

16891689
// attempt to switch the state, we assume we had a SUSPEND_REQUEST

0 commit comments

Comments
 (0)