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: backport RetriableStream bug fix (backport v1.40.x) #8387

Merged
merged 2 commits into from Aug 9, 2021

Conversation

dapengzhang0
Copy link
Member

@dapengzhang0 dapengzhang0 commented Aug 6, 2021

This is backport of #8386 and #8393

There is a bug in the scenario of the following sequence of events:

- `call.start()` 
- received retryable status and about to retry
- The retry attempt Substream is created but not yet `drain()` 
- `call.cancel()`

But `stream.cancel()` cannot be called prior to `stream.start()`, otherwise retry will cause a failure with IllegalStateException. The current RetriableStream code must be fixed to not cancel a stream until `start()` is called in `drain()`.
@dapengzhang0 dapengzhang0 added this to the 1.40 milestone Aug 6, 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 enabled auto-merge (rebase) August 7, 2021 01:39
@dapengzhang0 dapengzhang0 changed the title core: fix bug RetriableStream cancel() racing with start() (backport v1.40.x) core: backport RetriableStream bug fix (backport v1.40.x) Aug 7, 2021
@dapengzhang0 dapengzhang0 merged commit f07e1e5 into grpc:v1.40.x Aug 9, 2021
@dapengzhang0 dapengzhang0 deleted the v1.40.x branch August 9, 2021 17:20
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 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