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

internal/singleflight: test flake #11784

Closed
bradfitz opened this issue Jul 18, 2015 · 4 comments
Closed

internal/singleflight: test flake #11784

bradfitz opened this issue Jul 18, 2015 · 4 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

https://storage.googleapis.com/go-build-log/2d6a1955/windows-amd64-gce_21f24cce.log

...
--- FAIL: TestDoDupSuppress (0.01s)
    singleflight_test.go:74: number of calls = 10; want over 0 and less than n
FAIL
FAIL    internal/singleflight   0.076s
...
@bradfitz bradfitz self-assigned this Jul 18, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.5 milestone Jul 18, 2015
@rsc
Copy link
Contributor

rsc commented Jul 21, 2015

Why should it be less than n?

@bradfitz
Copy link
Contributor Author

The error message is trying to say that at least one of n calls should be dup-suppressed.

I can imagine various test-deflaking strategies but I wanted to reproduce it before I mailed one out. So far I've been unable to reproduce on Darwin or Linux, so I'll try Windows next.

@rsc rsc modified the milestones: Go1.5Maybe, Go1.5 Jul 22, 2015
@aclements
Copy link
Member

I've been running run.bash in a loop on my linux/amd64 workstation for the past few days and I've gotten this failure at least once. I think Rick has run in to it, too.

This test seems broken to me. If the goroutines started in the loop run sequentially, calls will be 10. I'm not sure we can fix this without relying on timing in some way, but what if instead of the outer goroutine doing the delay, the first call to fn sent to the channel and then slept for a bit? That would ensure at least one of them was in the Do and that duplicate suppression was active for the duration of the sleep.

@aclements
Copy link
Member

I can reproduce this pretty easily on my linux/amd64 laptop with

stress -p 16 ./singleflight.test -test.short

where 16 is four times the number of CPUs on the machine. The overload seems to be necessary.

@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe Jul 27, 2015
@golang golang locked and limited conversation to collaborators Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants