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

gRPC Trailers-Only response doesn't mark a streaming request as finished #2313

Merged
merged 2 commits into from
Aug 10, 2022

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Aug 9, 2022

Motivation:

If server returns a Trailers-Only response for a streaming request, we
never drain the response message-body, because concat never subscribes
to the next source if the first source fails. As the result, concurrency
controller won't mark the request as finished. If the request publisher
never completes we will start leaking h2 connections because streams
won’t be closed.

Modifications:

  • Enhance TrailersOnlyErrorTest to cover blocking client and make sure
    the HTTP response terminates;
  • In case of an error in Trailers-Only response, subscribe and cancel
    the response message body to abort the request;
  • Always check that Trailers-Only response doesn't have any further
    frames on the wire;

Result:

gRPC response correctly terminates even if client receives a
Trailers-Only response.

Motivation:

If server returns a `Trailers-Only` response for a streaming request, we
never drain the response message-body, because `concat` never subscribes
to the next source if the first source fails. As the result, concurrency
controller won't mark the request as finished. If the request publisher
never completes we will start leaking connections.

Modifications:

- Enhance `TrailersOnlyErrorTest` to cover blocking client and make sure
the HTTP response terminates;
- In case of an error in `Trailers-Only` response, subscribe and cancel
the response message body to abort the request;
- Always check that `Trailers-Only` response doesn't have any further
frames on the wire;

Result:

gRPC response correctly terminates even if client receives a
`Trailers-Only` response.
@tkountis
Copy link
Contributor

excellent find 🎸

@idelpivnitskiy idelpivnitskiy merged commit 986a80c into apple:main Aug 10, 2022
@idelpivnitskiy idelpivnitskiy deleted the trailers-only branch August 10, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants