-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
les/vflux/client, p2p/nodestate: fix data races #24058
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea whether the semantics are ok, but I'm not able to find any race in the tests any longer with this PR, so that's good.
One nitpick, though
les/vflux/client/serverpool_test.go
Outdated
@@ -54,6 +54,8 @@ type ServerPoolTest struct { | |||
db ethdb.KeyValueStore | |||
clock *mclock.Simulated | |||
quit chan chan struct{} | |||
stopping bool | |||
queryWg *sync.WaitGroup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use a sync.WaitGroup
instead of a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to remove the pointer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it back and added comments to explain why it needs to be recreated each time and how the waitgroup is used safely :)
I think the changes in les/vflux/client tests violate WaitGroup semantics, and will lead to occasional crashes in tests. We could ignore this and merge anyway, but then the tests will subtly wrong in a different and less-detectable way. Also, the fix applied here is super ugly. To make a meaningful improvement, it should at least be documented what the scope of the lock is. Does it apply to everything in |
cf698a2
to
4289f1b
Compare
4289f1b
to
d45309b
Compare
Now I think it's mergeable |
This PR fixes some data races in the server pool tests and also one in the NodeStateMachine.
Fixes #23848