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

Potential fix for race condition exposed by Node #5625

Merged
merged 2 commits into from
Mar 7, 2016

Conversation

ctiller
Copy link
Member

@ctiller ctiller commented Mar 7, 2016

No description provided.

@murgatroid99
Copy link
Member

I have run the test that was previously failing several hundred times locally with this change, and it has not yet failed. The previous failure rate was around 1/20.

holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
if (holder->connected_subchannel == NULL) {
fail_locked(exec_ctx, holder);
} else {
gpr_atm_rel_store(
Copy link
Member

Choose a reason for hiding this comment

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

So, there's a similar rel_store in line 156 above. Is that one not dangerous also?

Copy link
Member

Choose a reason for hiding this comment

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

The answer to this question is that by the time we reach line 156 we've already checked the value of call and determined that it is definitely NULL. We've already separately handled the CANCELED_CALL case and all other values. Additionally, all modifications to this value are under the lock. Arguably, then, all CAS'es should be gone and replaced with load/store pairs (though we do still need an atomic load for when it is checked outside a lock). That is a TODO for later.

vjpai added a commit that referenced this pull request Mar 7, 2016
Potential fix for race condition exposed by Node
@vjpai vjpai merged commit 06ba6cb into grpc:master Mar 7, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 28, 2019
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