-
Couldn't load subscription status.
- Fork 2.1k
derp/derphttp: de-flake TestBreakWatcherConnRecv with memnet and synctest #17356
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
Conversation
|
Okay, so this doesn't fully fix it, but the data race now reproduces reliably locally, where previously it was flaky: Progress! |
|
Exciting! |
|
I think the data race is fixed, so this is ready for review. ✨ |
|
This is awesome thanks! ✨ |
2365a1c to
9912ebb
Compare
|
Pushed a new commit which uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also reorder or squash the commits so there's no point in the git history where there are failing tests?
You might be able to use tstest.WhileTestRunningLogger to the data race too.
Yup, that's the plan, but I thought all the indentation changes in the |
Using memnet and synctest removes flakiness caused by real networking and subtle timing differences. Additionally, remove the `t.Logf` call inside the server's shutdown goroutine that was causing a false positive data race detection. The race detector is flagging a double write during this `t.Logf` call. This is a common pattern, noted in golang/go#40343 and elsehwere in this file, where using `t.Logf` after a test has finished can interact poorly with the test runner. This is a long-standing issue which became more common after rewriting this test to use memnet and synctest. Fixed #17355 Signed-off-by: Alex Chan <alexc@tailscale.com>
9912ebb to
6ef3f5e
Compare
TestBreakWatcherConnRecvhas been flaky for a while (#17355), which you can reliably reproduce locally withgolang.org/x/tools/cmd/stress.There's a TODO comment in those tests: "use memnet and synctest". Rewriting the test to use both of those seems to fix the flakiness. I've done 150,000 runs locally with no failures, where previously the tests would fail within a few hundred runs. The test also seems to run a lot faster now. 💪
I recommend reviewing the commits separately – the memnet changes are much easier to read in their own commit. I'll squash them into a single commit when I merge.
Updates #17355