fix: resolve two root causes of vrf v1 nightly race#22073
Closed
fix: resolve two root causes of vrf v1 nightly race#22073
Conversation
Contributor
|
I see you updated files related to
|
Contributor
|
✅ No conflicts with other open PRs targeting |
|
The scheduled go_core_race_tests job on develop reports three data races in TestDelegate_InvalidLog. They trace to two independent root causes: 1. core/services/vrf/delegate_test.go double-spawns the v1 listener's head and log goroutines. Listener.Start already spawns both (listener_v1.go:154-155). The extra goroutines send to the unbuffered WaitOnStop channel, which Close drains exactly twice (listener_v1.go: 519-520), so two goroutines leak per test. A leaked head listener can still invoke pipeline.Run → Debugw after t.done=true is written at testing.go:2023, racing with the stdlib's deliberately-unsynchronized test-completion flag. 2. core/internal/cltest.NewEthMocksWithStartupAssertions omits a BalanceAt expectation. The chain's default-enabled BalanceMonitor worker calls BalanceAt on the mock while its ctx is being cancelled by StopRChan.CtxCancel. Without an expectation, testify's m.fail → callString path uses %#v (mock.go:463), which reflects through *cancelCtx's unexported atomic.Value fields and races with the concurrent atomic stores in (*cancelCtx).cancel. Registering a Maybe() expectation routes calls through the happy path, which only uses %v via Stringer and never reflects.
39b7ae3 to
4573dc3
Compare
jmank88
reviewed
Apr 20, 2026
| c.On("CodeAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return([]byte{}, nil) | ||
| c.On("NonceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(uint64(0), nil) | ||
| c.On("PendingNonceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(uint64(0), nil) | ||
| c.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(big.NewInt(0), nil) |
Contributor
There was a problem hiding this comment.
Hmm I thought we tried this? Don't some callers set it themselves with different values? Great if not though
Comment on lines
-201
to
-207
| // Start the listenerV1 | ||
| go func() { | ||
| listener.RunLogListener([]func(){}, 6) | ||
| }() | ||
| go func() { | ||
| listener.RunHeadListener(func() {}) | ||
| }() |
|
Collaborator
Author
|
Closing — helper-level BalanceAt mock in cltest.go breaks ~20 tests deterministically (testify first-match-wins absorbs per-test .Once() expectations). Will reopen targeted approach per #22042. |
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