connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.76k stars 91 forks source link

Transport-level retry support for RPCs with streaming request #672

Open jhump opened 5 months ago

jhump commented 5 months ago

With HTTP/2, when a server is performing graceful shutdown, it sends a GOAWAY frame to a client, if the client tries to start a new stream. During this shutdown, the server refuses new streams and will continue processing existing streams until they are complete (or until some timeout occurs).

With a connect-go client, this can result in errors like the following:

unavailable: http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error

PR #649 addresses the above issues when it comes to handling unary requests (unary and server-stream RPCs). But it's still a possible issue with streaming requests.

Implementing GetBody with a streaming request is more complicated because it will involve buffering some (likely small) amount of request data, as the client is uploading, which can then be "replayed" in the event of a transport-level retry and use of GetBody. This issue is to track the state of such a future enhancement.