Skip to content

Commit e398266

Browse files
runtime: don't block preemption signal in new M's or ensureSigM
No test because we already have a test in the syscall package. The issue reports 1 failure per 100,000 iterations, which is rare enough that our builders won't catch the problem. Fixes #52226 Change-Id: I17633ff6cf676b6d575356186dce42cdacad0746 Reviewed-on: https://go-review.googlesource.com/c/go/+/400315 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent df08c9a commit e398266

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/signal_unix.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,7 @@ func unminitSignals() {
12471247
// blockableSig reports whether sig may be blocked by the signal mask.
12481248
// We never want to block the signals marked _SigUnblock;
12491249
// these are the synchronous signals that turn into a Go panic.
1250+
// We never want to block the preemption signal if it is being used.
12501251
// In a Go program--not a c-archive/c-shared--we never want to block
12511252
// the signals marked _SigKill or _SigThrow, as otherwise it's possible
12521253
// for all running threads to block them and delay their delivery until
@@ -1257,6 +1258,9 @@ func blockableSig(sig uint32) bool {
12571258
if flags&_SigUnblock != 0 {
12581259
return false
12591260
}
1261+
if sig == sigPreempt && preemptMSupported && debug.asyncpreemptoff == 0 {
1262+
return false
1263+
}
12601264
if isarchive || islibrary {
12611265
return true
12621266
}

0 commit comments

Comments
 (0)