Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce default connection time to 10s (from 32s)
Browse files Browse the repository at this point in the history
This helps to address docker/cli#1739, where an
invalid `DOCKER_HOST` setting could result in a 64s delay (that's twice the
delay here because the client was trying to hit the `/_ping` endpoint twice,
which was addressed in moby/moby#39206)

I made a previous attempt to fix this purely on the Docker cli side
(docker/cli#1872) however that had the side effect of
adding the timeout across the board and not just for the dial phase, which
caused a regression for `docker logs -f` (docker/cli#1892)
and so was reverted (docker/cli#1893).

The new value of 10s is just based on a gut feeling, no initial connection
should be taking that long in the real world unless something about the network
link is pretty broken (e.g. bad dns perhaps), in which case affected users are
surely pretty used to retrying things, better to fail faster in the normal case.

Also drop the comment since the linked issue just shows that the original
number, just like the new number, was arrived at fairly arbitrarily based on
gut feelings (rather than anything empirical) so the reference is not really
terribly useful.

Signed-off-by: Ian Campbell <[email protected]>
Ian Campbell committed May 17, 2019
1 parent b44139d commit 8e8f92a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sockets/sockets.go
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@ import (
"time"
)

// Why 32? See https://github.com/docker/docker/pull/8035.
const defaultTimeout = 32 * time.Second
const defaultTimeout = 10 * time.Second

// ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system.
var ErrProtocolNotAvailable = errors.New("protocol not available")

0 comments on commit 8e8f92a

Please sign in to comment.