-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Fixes refcounting issue #14315
Fixes refcounting issue #14315
Conversation
|
|
|
20a24d0
to
f069dd4
Compare
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thanks!
|
Why is this fix necessary? All of the callbacks that this adds refs for run as part of handling a batch sent down from the surface, and the surface maintains a ref to the call stack for each pending batch. The batch can't return until these callbacks return, so there should be no way for the call stack to be unreffed before the batches return. What am I missing here? Also, can we add a test that triggers the problem that this solves, so that we won't have regressions in the future? |
@markdroth
In the second call, we can see the "completion" unref happens before the "perform_stream_op". I suspect batches are getting early-completed on cancellation. |
I suspect |
Fixes issue #13327.
De-referencing the stack in the cancellation callback is unsafe. There may be closures on the executor that need the call stack, and cancellation can happen before they are run.