Skip to content

Commit c9ffcca

Browse files
author
Bryan C. Mills
committed
net: increase timing slop in TimeoutFluctuation tests on NetBSD and OpenBSD
Decrease the slop everywhere else, since NetBSD and OpenBSD seem to be the only ones that miss by that much. For #50189 Updates #36108 Change-Id: I22ac39cc7c254e40358fcd933b5a6016629602c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/372215 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
1 parent 58e8e26 commit c9ffcca

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/net/timeout_test.go

+14-4
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,20 @@ const (
644644
// timeoutUpperBound returns the maximum time that we expect a timeout of
645645
// duration d to take to return the caller.
646646
func timeoutUpperBound(d time.Duration) time.Duration {
647-
// In https://storage.googleapis.com/go-build-log/1e637cd3/openbsd-amd64-68_3585d3e7.log,
648-
// we observed that an openbsd-amd64-68 builder took 636ms for a 512ms timeout
649-
// (24.2% overhead).
650-
return d * 4 / 3
647+
switch runtime.GOOS {
648+
case "openbsd", "netbsd":
649+
// NetBSD and OpenBSD seem to be unable to reliably hit deadlines even when
650+
// the absolute durations are long.
651+
// In https://build.golang.org/log/c34f8685d020b98377dd4988cd38f0c5bd72267e,
652+
// we observed that an openbsd-amd64-68 builder took 4.090948779s for a
653+
// 2.983020682s timeout (37.1% overhead).
654+
// (See https://go.dev/issue/50189 for further detail.)
655+
// Give them lots of slop to compensate.
656+
return d * 3 / 2
657+
}
658+
// Other platforms seem to hit their deadlines more reliably,
659+
// at least when they are long enough to cover scheduling jitter.
660+
return d * 11 / 10
651661
}
652662

653663
// nextTimeout returns the next timeout to try after an operation took the given

0 commit comments

Comments
 (0)