diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go index cea68742d26..649854b746c 100644 --- a/src/os/signal/signal_test.go +++ b/src/os/signal/signal_test.go @@ -32,6 +32,11 @@ import ( // The current value is set based on flakes observed in the Go builders. var settleTime = 100 * time.Millisecond +// fatalWaitingTime is an absurdly long time to wait for signals to be +// delivered but, using it, we (hopefully) eliminate test flakes on the +// build servers. See #46736 for discussion. +var fatalWaitingTime = 30 * time.Second + func init() { if testenv.Builder() == "solaris-amd64-oraclerel" { // 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) { // General user code should filter out all unexpected signals instead of just // SIGURG, but since os/signal is tightly coupled to the runtime it seems // appropriate to be stricter here. - for time.Since(start) < settleTime { + for time.Since(start) < fatalWaitingTime { select { case s := <-c: if s == sig { @@ -97,7 +102,7 @@ func waitSig1(t *testing.T, c <-chan os.Signal, sig os.Signal, all bool) { timer.Reset(settleTime / 10) } } - t.Fatalf("timeout after %v waiting for %v", settleTime, sig) + t.Fatalf("timeout after %v waiting for %v", fatalWaitingTime, sig) } // quiesce waits until we can be reasonably confident that all pending signals