test(network): fix race in TestNotifier_VariousFlows/Happy_flow - #4502
Merged
Conversation
The subtest waited until the receiver callback had run twice and then read the persisted event, expecting two retries. notifyNow increments and writes the retry count only after the callback returns, so on a loaded runner the read could land between the second callback and its write and observe one retry. Same race as fixed for TestNotifier_Notify in #4274; observed on #4487. The subtest now waits for the persisted retry count and checks that the callback ran at least that often. Assisted-by: AI
stevenvegt
requested review from
Dirklectisch,
JorisHeadease,
gerardsn,
reinkrul and
woutslakhorst
as code owners
September 9, 2026 09:56
This was referenced Sep 9, 2026
reinkrul
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the flaky
TestNotifier_VariousFlows/Happy_flowseen on #4487.The subtest waited until the receiver callback had run twice and then read the persisted event, expecting two retries.
notifyNowincrements and writes the retry count only after the callback returns, and the next retry follows within tens of milliseconds, so on a loaded runner the read could land between the second callback and its write and observe one retry (expected 2, actual 1). It is the same race that #4274 fixed forTestNotifier_Notify; the other subtests in this function already wait on the persisted retry count.The subtest now waits for the persisted retry count to reach 2 and checks that the callback ran at least that often. Verified with
go test -race -count=30on the package.Backports to V6.2 and V5.4 follow, both branches have the same subtest.