Unref global backup poller while under its lock#13670
Merged
apolcyn merged 1 commit intogrpc:masterfrom Dec 7, 2017
Merged
Conversation
|
dgquintas
reviewed
Dec 7, 2017
Contributor
There was a problem hiding this comment.
wouldn't you have to unconditionally unlock?
Contributor
Author
There was a problem hiding this comment.
It leaves the old unlock within the if, I think it's ok
|
|
dgquintas
approved these changes
Dec 7, 2017
a44404b to
f7a869f
Compare
Contributor
Author
|
Just updated with small change to the ruby test since it got caught in the ruby style checker |
|
|
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13272
Tweaks the flakey ruby test to exaggerate the failure in that issue, and should fix the issue (I'm not able to reproduce after the fix).
It looks to me like there's a race between the setting of
g_pollertonullptrand a newly malloc'dbackup_poller.I wasn't able to run this under TSAN due to difficulty in building with ruby under TSAN, but still there seems to be a race for example in this scenario:
grpc_client_channel_start_backup_pollingand setsg_pollerto a new backup pollergrpc_client_channel_stop_backup_pollingand then unrefsg_poller->refs, but hasn't acquiredg_poller_muyet.grpc_client_channel_start_backup_pollingand acquiresg_poller_mu. It doesn't setg_pollerto anything new since it isn'tnullptrat this point.g_poller_muand setsg_pollertonullptr, since it thinks there are no still refs on it.g_pollerwill be unexpectedly set tonullptr. (under gdb, I consistently saw the segfault withingrpc_client_channel_start_backup_polling, whereg_pollerwas not set to a valid pointer).