Repository navigation
test(consensus): fix flaky TestByzantinePrevoteEquivocation (backport #5814) - #5841
Merged
Merged
Conversation
## Summary Fix the failing CI at https://github.com/cometbft/cometbft/actions/runs/25421557069/job/74564693795?pr=5837 `TestByzantinePrevoteEquivocation` was sporadically timing out on CI under the `-race` detector. The root cause was goroutine leaks: subscriptions were created with `context.Background()`, so the subscriber goroutines had no clean exit path when a block with evidence never arrived — they blocked forever on `sub.Out()`, leaked across tests, and exhausted resources on the runner. ## Changes - Replace `for range sub.Out()` with a `select` that also handles `sub.Canceled()`, so goroutines exit cleanly when the eventbus stops during test cleanup - Add `subErrCh` to surface unexpected subscription cancellation errors instead of silently swallowing them ## Test plan - [x] `go test ./consensus/... -run TestByzantinePrevoteEquivocation -v -count=1` passes locally - [x] CI passing (cherry picked from commit f56fbf1)
Contributor
|
PR author is not in the allowed authors list. |
2 tasks done
mattac21
approved these changes
May 7, 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.
Summary
Fix the failing CI at https://github.com/cometbft/cometbft/actions/runs/25421557069/job/74564693795?pr=5837
TestByzantinePrevoteEquivocationwas sporadically timing out on CI under the-racedetector. The root cause was goroutine leaks: subscriptions were created withcontext.Background(), so the subscriber goroutines had no clean exit path when a block with evidence never arrived — they blocked forever onsub.Out(), leaked across tests, and exhausted resources on the runner.Changes
for range sub.Out()with aselectthat also handlessub.Canceled(), so goroutines exit cleanly when the eventbus stops during test cleanupsubErrChto surface unexpected subscription cancellation errors instead of silently swallowing themTest plan
go test ./consensus/... -run TestByzantinePrevoteEquivocation -v -count=1passes locallyThis is an automatic backport of pull request test(consensus): fix flaky TestByzantinePrevoteEquivocation #5814 done by Mergify.