Skip to content

Commit 7899241

Browse files
[release-branch.go1.17] 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. For #52226 Fixes #52374 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]> (cherry picked from commit e398266) Reviewed-on: https://go-review.googlesource.com/c/go/+/400317 Reviewed-by: Austin Clements <[email protected]>
1 parent 2150be1 commit 7899241

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
@@ -1151,6 +1151,7 @@ func unminitSignals() {
11511151
// blockableSig reports whether sig may be blocked by the signal mask.
11521152
// We never want to block the signals marked _SigUnblock;
11531153
// these are the synchronous signals that turn into a Go panic.
1154+
// We never want to block the preemption signal if it is being used.
11541155
// In a Go program--not a c-archive/c-shared--we never want to block
11551156
// the signals marked _SigKill or _SigThrow, as otherwise it's possible
11561157
// for all running threads to block them and delay their delivery until
@@ -1161,6 +1162,9 @@ func blockableSig(sig uint32) bool {
11611162
if flags&_SigUnblock != 0 {
11621163
return false
11631164
}
1165+
if sig == sigPreempt && preemptMSupported && debug.asyncpreemptoff == 0 {
1166+
return false
1167+
}
11641168
if isarchive || islibrary {
11651169
return true
11661170
}

0 commit comments

Comments
 (0)