-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
runtime/race: deflake tests #14119
Comments
CL https://golang.org/cl/18968 mentions this issue. |
We set GOMAXPROCS=1 to prevent test flakiness. There are two sources of flakiness: 1. Some tests rely on particular execution order. If the order is different, race does not happen at all. 2. Ironically, ThreadSanitizer runtime contains a logical race condition that can lead to false negatives if racy accesses happen literally at the same time. Tests used to work reliably in the good old days of GOMAXPROCS=1. So let's set it for now. A more reliable solution is to explicitly annotate tests with required execution order by means of a special "invisible" synchronization primitive (that's what is done for C++ ThreadSanitizer tests). This is issue #14119. This reduces flakes on RaceAsFunc3 test from 60/3000 to 1/3000. Fixes #14086 Fixes #14079 Fixes #14035 Change-Id: Ibaec6b2b21e27b62563bffbb28473a854722cf41 Reviewed-on: https://go-review.googlesource.com/18968 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Ideally this would happen, but I think Dmitriy is the only one who can really do it. |
#19604 was marked as a dup of this bug. If these tests can't be made reliable, I think it's time to disable them. Or give them, say, 10 chances to succeed before reporting a failure. Marking this as Go 1.9 to either fix them, disable them or make them try harder to pass. |
Another instance of #19604: https://build.golang.org/log/72ead1aab99537284ab770f1babb89492441db0b |
How's it going @dvyukov? Might you have any bandwidth for this bug? Thanks. |
@odeke-em No, but you don't need to wait for me. We need something simple along the following lines:
However, I wasn't able to reproduce any flakes on tip. I've tried:
With different values of |
Change https://golang.org/cl/267998 mentions this issue: |
I was just looking into cleaning this up, and AFAICT, The test was added in 908e1b5. I suspect In practice, the timer function may execute just after the function returns (racing with
|
For #14119 Change-Id: I2a9ae43da228cf5c3e38d1f0d1b0768145b6548f Reviewed-on: https://go-review.googlesource.com/c/go/+/267998 Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Ian Lance Taylor <iant@golang.org>
See https://go-review.googlesource.com/#/c/18968 for context.
Race tests run with GOMAXPROCS=1, this makes them more or less reliable. But the ultimate solution is to explicitly annotate tests with required execution order by means of a special "invisible" synchronization primitive (that's what is done for C++ ThreadSanitizer tests). But that would require going over 350 tests.
The text was updated successfully, but these errors were encountered: