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

core: fix RetriableStream edge case bug introduced in #8386 #8393

Merged
merged 1 commit into from Aug 7, 2021

Conversation

dapengzhang0
Copy link
Member

While adding regression tests to #8386, I found a bug in an edge case: while retry attempt is draining the last buffered entry, if it is in the mean time committed and then we cancel the call, the stream will never be cancelled. See the regression test case commitAndCancelWhileDraining().

Although we can add regression test that reproduces any bug we found, we can not really unit-test race condition, so I try to make the concurrency control logic simple and readably, but it's still hard to prove the correctness, nay...

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

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

I have little confidence that there isn't another similar bug. This seems like further evidence we really need to change the approach here later.

@dapengzhang0 dapengzhang0 merged commit cbda32a into grpc:master Aug 7, 2021
@dapengzhang0 dapengzhang0 deleted the fix-retry-cancel-race-2 branch August 7, 2021 01:32
@dapengzhang0 dapengzhang0 added the TODO:backport PR needs to be backported. Removed after backport complete label Aug 7, 2021
dapengzhang0 added a commit to dapengzhang0/grpc-java that referenced this pull request Aug 7, 2021
…#8393)

While adding regression tests to grpc#8386, I found a bug in an edge case: while retry attempt is draining the last buffered entry, if it is in the mean time committed and then we cancel the call, the stream will never be cancelled. See the regression test case `commitAndCancelWhileDraining()`.
@dapengzhang0 dapengzhang0 removed the TODO:backport PR needs to be backported. Removed after backport complete label Aug 7, 2021
dapengzhang0 added a commit that referenced this pull request Aug 9, 2021
While adding regression tests to #8386, I found a bug in an edge case: while retry attempt is draining the last buffered entry, if it is in the mean time committed and then we cancel the call, the stream will never be cancelled. See the regression test case `commitAndCancelWhileDraining()`.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2021
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

2 participants