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

executor: synchronize exitState accesses #5433

Merged
merged 1 commit into from
Mar 18, 2019
Merged

executor: synchronize exitState accesses #5433

merged 1 commit into from
Mar 18, 2019

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented Mar 18, 2019

exitState is set in wait() goroutine but accessed in a different
Wait() goroutine, so accesses must be synchronized by a lock.

exitState is set in `wait()` goroutine but accessed in a different
`Wait()` goroutine, so accesses must be synchronized by a lock.
@notnoop notnoop requested a review from schmichael March 18, 2019 15:15
Copy link
Member

@nickethier nickethier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@notnoop notnoop merged commit b3bedeb into master Mar 18, 2019
@notnoop notnoop deleted the b-exit-state-lock branch March 18, 2019 17:50
@schmichael
Copy link
Member

Did the race detector complain? I don't see the race because exitState is set before processExited is closed, and read after processExited is received. I think processExited properly serializes access.

@notnoop
Copy link
Contributor Author

notnoop commented Mar 18, 2019

tbh, I didn't check the race detector :(, just assumed by reading code; didn't realize that channel operations constitutes happens-before relationship for other variables. But you are right: https://golang.org/ref/mem#tmp_7 - thanks. I can revert this to simplify code.

notnoop added a commit that referenced this pull request Mar 20, 2019
Reverts #5433

Apparently, channel communications can constitute Happens-Before even for proximate variables, so this syncing isn't necessary.

> _The closing of a channel happens before a receive that returns a zero value because the channel is closed._
https://golang.org/ref/mem#tmp_7
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants