Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context: ExampleWithTimeout failures #57594

Closed
gopherbot opened this issue Jan 4, 2023 · 3 comments
Closed

context: ExampleWithTimeout failures #57594

gopherbot opened this issue Jan 4, 2023 · 3 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@gopherbot
Copy link

#!watchflakes
post <- pkg == "context" && test == "ExampleWithTimeout"

Issue created automatically to collect these failures.

Example (log):

--- FAIL: ExampleWithTimeout (0.02s)
got:
overslept
want:
context deadline exceeded

watchflakes

@gopherbot gopherbot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 4, 2023
@gopherbot
Copy link
Author

Found new dashboard test flakes for:

#!watchflakes
post <- pkg == "context" && test == "ExampleWithTimeout"
2022-11-16 02:02 openbsd-arm64-jsing go@cb5534c1 context.ExampleWithTimeout (log)
--- FAIL: ExampleWithTimeout (0.02s)
got:
overslept
want:
context deadline exceeded

watchflakes

@bcmills
Copy link
Contributor

bcmills commented Jan 6, 2023

This test uses an arbitrary 1-second timeout:
https://cs.opensource.google/go/go/+/master:src/context/example_test.go;l=88;drc=5d2ddcd3f51c1ff7aa0a84604b1d8610a17a7933

No wonder it is flaky!

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. labels Jan 6, 2023
@bcmills bcmills added this to the Go1.21 milestone Jan 6, 2023
@bcmills bcmills self-assigned this Jan 6, 2023
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 6, 2023
@gopherbot
Copy link
Author

Change https://go.dev/cl/460999 mentions this issue: context: eliminate arbitrary timeouts in examples

eric pushed a commit to fancybits/go that referenced this issue Sep 7, 2023
ExampleWithDeadline and ExampleWithTimeout used an arbitrary 1-second
timeout for a “blocked” select case, which could fail if the test
goroutine happens to be descheduled for over a second, or perhaps if
an NTP synchronization happens to jump by a second at just the right
time.

Either case is plausible, especially on a heavily-loaded or slow
machine (as is often the case for builders for unusual ports).

Instead of an arbitrary timeout, use a “ready” channel that is never
actually ready.

Fixes golang#57594.

Change-Id: I9ff68f50b041a3382e7b267c28c5259e886a9d23
Reviewed-on: https://go-review.googlesource.com/c/go/+/460999
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
@golang golang locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
Status: Done
Development

No branches or pull requests

2 participants