ttrpc icon indicating copy to clipboard operation
ttrpc copied to clipboard

Context canceled error returned instead of ErrClosed

Open dmcgowan opened this issue 2 years ago • 1 comments

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 avatar Mar 30 '23 20:03 dmcgowan

@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.

austinvazquez avatar Feb 28 '24 16:02 austinvazquez