Skip to content

Fix data race in newWatchEventPeer#2714

Closed
dawn-minion wants to merge 1 commit into
osrg:masterfrom
dawn-minion:data_race_watcher
Closed

Fix data race in newWatchEventPeer#2714
dawn-minion wants to merge 1 commit into
osrg:masterfrom
dawn-minion:data_race_watcher

Conversation

@dawn-minion
Copy link
Copy Markdown
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
Copy Markdown
Member

fujita commented Oct 3, 2023

How this is related with?
#2715

We need both or either?

@dawn-minion
Copy link
Copy Markdown
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
Copy Markdown
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