Skip to content
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

Fix data race in newWatchEventPeer #2714

Closed
wants to merge 1 commit into from

Conversation

dawn-minion
Copy link
Contributor

This method was attempting to read from peer.fsm before acquiring a read lock, leading to a data race as this struct is written by a different goroutine in parallel. Commit moves the call to RLock before the first read from the struct.

Issue was flagged when the project was built with Golang's data race detector.

This method was attempting to read from peer.fsm before acquiring a read
lock, leading to a data race as this struct is written by a different
goroutine in parallel. Commit moves the call to RLock before the first
read from the struct.
@fujita
Copy link
Member

fujita commented Oct 3, 2023

How this is related with?
#2715

We need both or either?

@dawn-minion
Copy link
Contributor Author

dawn-minion commented Oct 3, 2023

All 3 are separate data races, and all 3 are needed - I opened them as 3 pull requests in case changes were needed.

EDIT: I can merge it in to one of course if you prefer.

@fujita
Copy link
Member

fujita commented Oct 24, 2023

thanks

@fujita fujita closed this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants