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

stub: avoid race in onHalfClose server StreamObserver #5991

Merged
merged 1 commit into from
Jul 19, 2019

Conversation

carl-mastrangelo
Copy link
Contributor

No description provided.

@zhangkun83
Copy link
Contributor

LGTM

@@ -171,7 +172,7 @@ public void onHalfClose() {
method.invoke(request, responseObserver);
request = null;
responseObserver.freeze();
if (call.isReady()) {
if (!wasReady) {
Copy link
Member

Choose a reason for hiding this comment

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

This is inverted. It should be if (wasReady)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I thought you said onReady should only be called once, and it was which ever method (onHalfClose or onReady) was invoked first. Is that not correct?

Copy link
Member

Choose a reason for hiding this comment

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

Before onHalfClose(), onReadyHandler == null. So if there was an onReady callback, the code "ignored" it. The onReady() callback will generally happen before onHalfClose(). This check was to "replay" that missed onReady call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, updated.

@carl-mastrangelo carl-mastrangelo merged commit 148b7de into grpc:master Jul 19, 2019
@carl-mastrangelo carl-mastrangelo deleted the rayce branch July 19, 2019 19:24
@lock lock bot locked as resolved and limited conversation to collaborators Oct 17, 2019
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.

None yet

3 participants