ttrpc
ttrpc copied to clipboard
Context canceled error returned instead of ErrClosed
A flaky test was observed in containerd in the 1.1 branch after updating to 1.1.1
=== Failed
=== FAIL: . TestClientTTRPC_Close (0.00s)
client_ttrpc_test.go:85: assertion failed: context canceled (err *errors.errorString) != ttrpc: closed (ttrpc.ErrClosed *errors.errorString)
@dmcgowan, I believe I made some progress on this one. There is a race condition where the client's error can be set by the client's server response goroutine which was setting the error to c.ctx.Err(). This will always be context.Cancelled and can either be set to ErrClosed or return and allow the client.Close function to always set the error here. Interested in your feedback.