Fixes race condition in Python server shutdown#13786
Merged
kpayson64 merged 1 commit intogrpc:v1.8.xfrom Dec 14, 2017
Merged
Conversation
62ba858 to
84491b0
Compare
nathanielmanistaatgoogle
suggested changes
Dec 14, 2017
Contributor
nathanielmanistaatgoogle
left a comment
There was a problem hiding this comment.
Content looks good, and hooray for code deletion and fulfilled TODOs.
In your commit log message: if the threading.RLock introduced in this commit is "second", which one is "first"?
Also: missing apostrophe in "be to rely on c-cores cancellation".
Contributor
|
How sure are we that |
84491b0 to
67fe3b0
Compare
When we set the call state to "CANCELLED" after grpc_cancel_all_calls, we would block other start batch operations from happening. The rpc_state for the cancelled call would still be in the server's rpc_states set, but it would never get removed because there were no active batches for the call, and the only place we remove from rpc_states is when a batch completes. It is better to rely on c-core's cancellation. Once a call is cancelled, all subsequent ops on that call will return immediately with a cancellation error. The RLock() change is due to the possibility that _on_call_completed gets invoked immediately when the call has already completed when the rpc_future callback is created.
67fe3b0 to
8179b95
Compare
Contributor
Author
|
I've updated the commit message and put this on 1.8.x Before 16/1000 timeouts |
nathanielmanistaatgoogle
approved these changes
Dec 14, 2017
Contributor
nathanielmanistaatgoogle
left a comment
There was a problem hiding this comment.
Thanks very much!
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.
When we set the call state to "CANCELLED" after
grpc_cancel_all_calls, we would block other start batch
operations from happening. The rpc_state for the cancelled
call would still be in the server's rpc_states set, but it
would never get removed because there were no active batches
for the call, and the only place we remove from rpc_states is
when a batch completes.
It is better to rely on c-core's cancellation. Once a call
is cancelled, all subsequent ops on that call will return
immediately with a cancellation error.
The "RLock()" change is due to the possibility that _on_call_completed
gets invoked immediately when the call has already completed when the
rpc_future callback is created.
Fixes #12668