Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a 10s timeout to the client object. #1872

Merged
merged 1 commit into from
May 14, 2019

Conversation

ijc
Copy link
Contributor

@ijc ijc commented May 13, 2019

This partially mitigates #1739 ("Docker commands take 1 minute to timeout if
context endpoint is unreachable") and is a simpler alternative to #1747 (which
completely defers the client connection until an actual call is attempted).

Note that the previous 60s delay was the culmination of two separate 30s
timeouts since the ping is tried twice. This with this patch the overall
timeout is 20s. moby/moby#39206 will remove the second
ping and once that propagates to this tree the timeout will be 10s.

Signed-off-by: Ian Campbell ijc@docker.com

This partially mitigates docker#1739 ("Docker commands take 1 minute to timeout if
context endpoint is unreachable") and is a simpler alternative to docker#1747 (which
completely defers the client connection until an actual call is attempted).

Note that the previous 60s delay was the culmination of two separate 30s
timeouts since the ping is tried twice. This with this patch the overall
timeout is 20s. moby/moby#39206 will remove the second
ping and once that propagates to this tree the timeout will be 10s.

Signed-off-by: Ian Campbell <ijc@docker.com>
@codecov-io
Copy link

Codecov Report

Merging #1872 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1872   +/-   ##
=======================================
  Coverage   56.75%   56.75%           
=======================================
  Files         309      309           
  Lines       21672    21672           
=======================================
  Hits        12301    12301           
  Misses       8472     8472           
  Partials      899      899

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

perhaps even shorter would work, wdyt? (not sure in what situation I would expect the connection to take anything over (say) 2..3 seconds

@thaJeztah
Copy link
Member

ok, let's get this one in; we can tweak in a follow-up

@thaJeztah thaJeztah merged commit 5f17b1d into docker:master May 14, 2019
@GordonTheTurtle GordonTheTurtle added this to the 19.09.0 milestone May 14, 2019
@ijc ijc deleted the reduce-connection-timeout branch May 14, 2019 09:40
@ijc
Copy link
Contributor Author

ijc commented May 14, 2019

10s is pretty conservative but really I have no data just a gut feeling. I suppose it's possible that slow DNS or perhaps an on-demand VPN link or something could take approaching that long to actually route traffic. But yes in the normal case I you'd reasonably expect something an order of magnitude faster.

ijc pushed a commit to ijc/go-connections that referenced this pull request May 17, 2019
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 <ijc@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants