Enable TCP Keep-Alive in Docker client#415
Merged
thaJeztah merged 1 commit intodocker:masterfrom Aug 3, 2017
Merged
Conversation
Some network environments may have NATs, proxies, or gateways which kill idle connections. There are many Docker API operations which may be idle for long periods of time (such as ContainerWait and ContainerAttach) and may result in unexpected connection closures or hangs if TCP keepalives are not used. This patch updates the default HTTP transport used by the Docker client package to enable TCP Keep-Alive with a keep-alive interval of 30 seconds. It also sets a connect timeout of 30 seconds. Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Member
|
ugh circleCI keeps having problems, now its a memory issue (possibly); |
Codecov Report
@@ Coverage Diff @@
## master #415 +/- ##
==========================================
- Coverage 46.26% 46.25% -0.02%
==========================================
Files 193 193
Lines 16093 16097 +4
==========================================
Hits 7445 7445
- Misses 8259 8263 +4
Partials 389 389 |
thaJeztah
approved these changes
Aug 3, 2017
This was referenced Aug 3, 2017
andrewhsu
reviewed
Aug 8, 2017
| tr := &http.Transport{ | ||
| TLSClientConfig: config, | ||
| DialContext: (&net.Dialer{ | ||
| KeepAlive: 30 * time.Second, |
Contributor
There was a problem hiding this comment.
For now this can help keep connections alive over the NAT timeout issue we've been facing, but would really like to see more knobs to turn in a configurable manner much like curl: https://curl.haxx.se/libcurl/c/CURLOPT_TCP_KEEPALIVE.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some network environments may have NATs, proxies, or gateways which
kill idle connections. There are many Docker API operations which may
be idle for long periods of time (such as ContainerWait and ContainerAttach)
and may result in unexpected connection closures or hangs if TCP keepalives
are not used.
This patch updates the default HTTP transport used by the Docker client
package to enable TCP Keep-Alive with a keep-alive interval of 30 seconds.
It also sets a connect timeout of 30 seconds.
This PR complements the change to the moby client package here: moby/moby#34359