Skip to content

client: do not fallback to GET if HEAD on _ping fail to connect#39206

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
ijc:no-retry-ping-on-errconn
May 15, 2019
Merged

client: do not fallback to GET if HEAD on _ping fail to connect#39206
cpuguy83 merged 1 commit intomoby:masterfrom
ijc:no-retry-ping-on-errconn

Conversation

@ijc
Copy link
Copy Markdown
Contributor

@ijc ijc commented May 13, 2019

When we see an ECONNREFUSED (or equivalent) from an attempted HEAD on the
/_ping endpoint there is no point in trying again with GET since the server
is not responding/available at all.

Once vendored into the cli this will partially mitigate docker/cli#1739
("Docker commands take 1 minute to timeout if context endpoint is unreachable")
by cutting the effective timeout in half.

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

(I'm also shortly going to raise a cli PR to further reduce the delay by reducing the timeout).

When we see an `ECONNREFUSED` (or equivalent) from an attempted `HEAD` on the
`/_ping` endpoint there is no point in trying again with `GET` since the server
is not responding/available at all.

Once vendored into the cli this will partially mitigate docker/cli#1739
("Docker commands take 1 minute to timeout if context endpoint is unreachable")
by cutting the effective timeout in half.

Signed-off-by: Ian Campbell <ijc@docker.com>
ijc pushed a commit to ijc/docker-cli that referenced this pull request May 13, 2019
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>
Copy link
Copy Markdown
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

@thaJeztah
Copy link
Copy Markdown
Member

experimental failures are unrelated

docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request May 14, 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>
Upstream-commit: 59defcb34d5be358ebaacaadd21ed7e6307a493e
Component: cli
@codecov
Copy link
Copy Markdown

codecov bot commented May 14, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@3042254). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master   #39206   +/-   ##
=========================================
  Coverage          ?   37.03%           
=========================================
  Files             ?      612           
  Lines             ?    45490           
  Branches          ?        0           
=========================================
  Hits              ?    16845           
  Misses            ?    26350           
  Partials          ?     2295

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

@cpuguy83 cpuguy83 merged commit de6df46 into moby:master May 15, 2019
@ijc ijc deleted the no-retry-ping-on-errconn branch May 15, 2019 09:04
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>
@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 2, 2020
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.

4 participants