docker / engine-api

DEPRECATED: Please see https://github.com/docker/docker/tree/master/client
Apache License 2.0
264 stars 163 forks source link

Go 1.7: context.DeadlineExceeded gets returned as ErrConnectionFailed #347

Closed tamird closed 8 years ago

tamird commented 8 years ago

Well, this was surprising.

In Go 1.7, the "golang.org/x/net/context" package is implemented in terms of the standard library's "context" package.

In particular, here is the definition of context.DeadlineExceeded. Let's follow that thread to the standard library's context.DeadlineExceeded. Note that this error is a custom type, unlike context.DeadlineExceeded pre-1.7.

Now, let's take a quick look at how engine-api determines when to return ErrConnectionFailed - it uses isTimeout.

Have you guessed it yet? Yep, the standard library's deadlineExceeded implements Timeout(), causing engine-api to report "is docker running?" when really the provided context timed out.

This should probably be fixed before the 1.7 release to save others the 3 or so hours I spent debugging this.