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

Add limited support for bidi streams over HTTP/1 #796

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emcfarlane
Copy link
Contributor

@emcfarlane emcfarlane commented Nov 8, 2024

This adds limited support for bidirectional streams over HTTP/1.x transports. It removes the explicit error response which disabled this behavior based on the protocol stream type. Bidi streams may now be used in half-duplex mode. This does not enable full-duplex streaming. All requests must be sent before responses are received.

This removes the workarounds in the conformance test suite to fake a HTTP/2 request/response in order to allow for this behavior. In doing so a deadlock on writing to a closed requests was fixed. See connectrpc/conformance#942.

Edit: Will look at improving the error messages on trying to do a full-duplex stream over HTTP/1.x. It should fail noting this isn't possible.

This adds limited support for bidirectional streams over HTTP1
transports. It removes the explicit error response which disabled this
behavior based on the protocol stream type. Bidi streams may now be used
in half-duplex mode. This does not enable full-duplex streaming. All
requests must be sent before responses are received.

This removes the workarounds in the conformance test suite to fake a
HTTP2 request/response in order to allow for this behavior. In doing so
a deadlock on writing to a closed requests was fixed.

Signed-off-by: Edward McFarlane <[email protected]>
Signed-off-by: Edward McFarlane <[email protected]>
@emcfarlane emcfarlane marked this pull request as draft November 8, 2024 20:43
@akshayjshah
Copy link
Member

I'd originally forbidden this because I thought it was too difficult to use correctly.

Clients are often created with an HTTPS URL (e.g., https://api.connectrpc.com). From that URL, it's not clear whether the server supports HTTP/2. In itself, that's okay. But per my recollection, attempting full-duplex streaming over HTTP/1.1 just hangs. The error message is also unhelpful - my memory is a little vague, but I think the client just gets a timeout, or a cancellation, or something equally unhelpful. To me, this felt like an easy trap to stumble into, and a difficult error to diagnose.

I'm open to allowing half-duplex streaming over HTTP/1.1, but I'd like to make sure that attempting full-duplex communication results in a clear error message.

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