-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth: fix race condition in eth/sync tests #522
base: master
Are you sure you want to change the base?
Conversation
I tested this in a super slow machine twice. First time I got a race but test finished. Second time I got a race and test hasn't finished because of timeout after 10 minutes.
|
Hm, thanks for the report. I'll come back with another. |
The race was discoverable with go test -race ./eth or under 'slow' machine conditions, eg. GOMAXPROCS=1 and/or a 'slower' machine. The race was around the minArtificialFinalityPeers value, which was both - assigned in (during) the tests, and - checked in the nextSyncOp function and the order of those uses was nondeterministic. This patch resolves the issue by moving the adhoc and temporary re-assignment of that package-wide value to the start of the tests, before any go routines for peer handling or sync protocol are fired off. Note that the real-clock timeouts in these tests can still cause spurious test failures under 'slow' conditions (see their 250ms sleeps). Fixes #521 Date: 2023-01-30 13:39:38-08:00 Signed-off-by: meows <[email protected]>
@ziogaschr found a(nother) race condition in the tests, which I have had a hard time dupliating with env GOMAXPROCS=1 go test -count 1 -race ./eth But this should, hopefully, fix the issue. Date: 2023-02-07 08:47:44-08:00 Signed-off-by: meows <[email protected]>
891b12b
to
ec625f6
Compare
Test failed with the following race condition:
|
The TestArtificialFinality.._xxx tests are racey because of this value; the tests want to manhandle it while the handler goroutines (and chainsyncop calls) are running. This might fix it, though it feels like overkill. Date: 2023-02-07 13:59:16-08:00 Signed-off-by: meows <[email protected]>
I'm still struggling to reproduce the issue, but above is another commit-swing at it. Thanks to @ziogaschr for being my canary in the coal mine. To test, I'm using:
|
Fixes #521
The race was discoverable with
go test -race ./eth
or under 'slow' machine conditions, eg. GOMAXPROCS=1 and/or a 'slower' machine.
The race was around the
minArtificialFinalityPeers
value, which was bothand the order of those uses was nondeterministic.
This patch resolves the issue by moving
the adhoc and temporary re-assignment of that
package-wide value to the start of the tests,
before any go routines for peer handling
or sync protocol are fired off.
Note that the real-clock timeouts in these
tests can still (invariantly) cause spurious test failures
under 'slow' conditions (see their 250ms sleeps).
This invariant limitation (seen in the upstream-identical tests
TestSnapSyncDisabling6[6|7]
) can be reproduced on my computer with:Reviewers can test the efficacy of this patch with