containerd / ttrpc

GRPC for low-memory environments
Apache License 2.0
558 stars 80 forks source link

Context canceled error returned instead of ErrClosed #137

Open dmcgowan opened 1 year ago

dmcgowan commented 1 year ago

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)
austinvazquez commented 8 months ago

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