eth/filters: fix flaky TestPendingTxFilterDeadlock#35334
Open
posidoni wants to merge 1 commit into
Open
Conversation
The test polls GetFilterChanges with a 100ms filter timeout. On a loaded system a >100ms gap between two polls lets the timeout loop uninstall the filter, so the next poll returns errFilterNotFound and the test fails. Treat that as a benign early timeout, gated on the deadline having actually elapsed; the uninstall is still verified through the sub.Err() wait at the end of the test. Also close the done channel so the tx-sending goroutine exits when the test finishes instead of spinning for the remainder of the test binary. Signed-off-by: Mikhail Kuznetsov <mikhail.n.kuznetsov@gmail.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
TestPendingTxFilterDeadlockfails intermittently under the race detector:Cause
The test sets a 100ms filter timeout and polls
GetFilterChangesuntil each filter has seen a transaction. Every successful poll resets the filter deadline. On a loaded system (race detector,t.Parallel, lowGOMAXPROCS) a single gap longer than 100ms between two polls letstimeoutLoopuninstall the filter, so the next poll returnserrFilterNotFoundand the test fails.This early timeout is not the deadlock the test guards against (#22131). That deadlock froze
filtersMu, soGetFilterChangeswould block on the lock instead of returningerrFilterNotFound.This is the only test in the package that configures a non-default filter timeout, so no other test is exposed to this race.
Fix
errFilterNotFoundduring the setup poll as a benign early timeout. The tolerance only applies once the filter has lived at least the configured timeout, so a regression that uninstalls filters before their deadline still fails the test. The uninstall itself is still verified by thesub.Err()wait at the end.donechannel on test exit. The tx-sending goroutine was never stopped and kept spinning for the rest of the test binary, adding load to subsequent tests.Verification
Before (M-series Mac):
go test -race -count=20 ./eth/filters/: 3 failures in 20 runsgo test -race -count=30 -cpu=1,2 -run 'TestPendingTxFilterDeadlock$' ./eth/filters/: 9+ failuresAfter:
-count=100and-count=100 -cpu=1,2(300 executions): all passgo test -race ./eth/filters/: pass