Skip to content

Commit 460900a

Browse files
AndrewGMorganodeke-em
authored andcommitted
os/signal: test with a significantly longer fatal timeout
We've observed some occasional os-arch specific timeouts in signal.TestSignalTrace(). While the main purpose of a short timeout is to ensure the passing tests complete quickly, the unexpected failure path can tolerate waiting longer (the test is not intended to test how slow or overloaded the OS is at the time it is run). Fixes #46736 Change-Id: Ib392fc6ce485a919612784ca88ed76c30f4898e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/329502 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Trust: Emmanuel Odeke <[email protected]>
1 parent b73cc4b commit 460900a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/os/signal/signal_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import (
3232
// The current value is set based on flakes observed in the Go builders.
3333
var settleTime = 100 * time.Millisecond
3434

35+
// fatalWaitingTime is an absurdly long time to wait for signals to be
36+
// delivered but, using it, we (hopefully) eliminate test flakes on the
37+
// build servers. See #46736 for discussion.
38+
var fatalWaitingTime = 30 * time.Second
39+
3540
func init() {
3641
if testenv.Builder() == "solaris-amd64-oraclerel" {
3742
// The solaris-amd64-oraclerel builder has been observed to time out in
@@ -84,7 +89,7 @@ func waitSig1(t *testing.T, c <-chan os.Signal, sig os.Signal, all bool) {
8489
// General user code should filter out all unexpected signals instead of just
8590
// SIGURG, but since os/signal is tightly coupled to the runtime it seems
8691
// appropriate to be stricter here.
87-
for time.Since(start) < settleTime {
92+
for time.Since(start) < fatalWaitingTime {
8893
select {
8994
case s := <-c:
9095
if s == sig {
@@ -97,7 +102,7 @@ func waitSig1(t *testing.T, c <-chan os.Signal, sig os.Signal, all bool) {
97102
timer.Reset(settleTime / 10)
98103
}
99104
}
100-
t.Fatalf("timeout after %v waiting for %v", settleTime, sig)
105+
t.Fatalf("timeout after %v waiting for %v", fatalWaitingTime, sig)
101106
}
102107

103108
// quiesce waits until we can be reasonably confident that all pending signals

0 commit comments

Comments
 (0)