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 races in WaitForState #8560

Merged
merged 2 commits into from
Aug 31, 2016
Merged

Fix races in WaitForState #8560

merged 2 commits into from
Aug 31, 2016

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Aug 30, 2016

The WaitForState method can't read the result values in a timeout
because they are still owned by the running goroutine. Keep all values
scoped inside the goroutine, and save them into an atomic.Value to be
returned.

Fixes race introduced in #8510

The WaitForState method can't read the result values in a timeout
because they are still owned by the running goroutine. Keep all values
scoped inside the goroutine, and save them into an atomic.Value to be
returned.

Fixes race introduced in #8510
clean up the code slighly by moving the Sleep in WaitForState to the end
of the loop.
@stack72
Copy link
Contributor

stack72 commented Aug 30, 2016

@radeksimko FYI - i missed this :(

@radeksimko
Copy link
Member

@stack72 Thanks for the ping.
@jbardin Thanks for discovering & fixing this.

Not that it's an excuse, but I believe the bug was there before #8510 , affecting resulterr. #8510 was just adding a new variable that became affected by that bug too. 😞

I can see now that the golang race detector would have discovered this. Maybe we could run the whole test suite once a day with the -race flag? Running it for every single time would be CPU/mem/time consuming.

@jbardin
Copy link
Member Author

jbardin commented Aug 31, 2016

@radeksimko Oh yes, your PR wasn't the primary culprit. The existing race was just missed because the errors paths weren't sufficiently exercised in the tests.

I'm testing for races thoroughly myself right now, and we have a separate integration test that runs make testrace to flag issues. Once the concurrency issues in core are sorted out I intend to make -race the default.

@mitchellh
Copy link
Contributor

LGTM

@jbardin jbardin merged commit e001419 into master Aug 31, 2016
@jbardin jbardin deleted the jbardin/race2 branch August 31, 2016 18:02
@ghost
Copy link

ghost commented Apr 22, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants