Commit 39b7ae3
committed
fix: resolve two root causes of vrf v1 nightly race
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.1 parent df2100a commit 39b7ae3
2 files changed
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| 634 | + | |
634 | 635 | | |
635 | 636 | | |
636 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
208 | 205 | | |
209 | 206 | | |
210 | 207 | | |
| |||
0 commit comments