connectrpc / connect-go

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

Update a couple of more places where we should return a context error if there is one #709

Closed jhump closed 6 months ago

jhump commented 6 months ago

This is effectively a continuation of #659, catching two more places that needed to be instrumented.

This issue was discovered when running conformance tests (https://github.com/connectrpc/conformance/issues/813). It was occurring consistently with full-duplex streams against one particular server implementation. I think that implementation was eagerly doing a server-side cancelation of the stream when the server saw that its deadline had elapsed, and that other implementations generally don't do this. In this particular case, the framework was observing the "RSTStream" frame and returning a "canceled" code even though the operation's context had already elapsed and had a "deadline exceeded" error. So the RPC was returning a "canceled" error code when it ideally would instead return a "deadline exceeded" code. This PR fixes that discrepancy.