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

net: lookupStaticHost caches for too long for Docker #13340

Closed
dtjm opened this issue Nov 20, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@dtjm
Copy link

commented Nov 20, 2015

https://golang.org/src/net/hosts.go#L12

It would be nice if this value was configurable, because in Docker, if you restart a container, any linked containers have their /etc/hosts file updated.

@rsc rsc changed the title lookupStaticHost is cached for 5 minutes, make it configurable net: lookupStaticHost caches for too long for Docker Dec 28, 2015

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2015

Maybe instead of configurable it just needs a better default. It could stat /etc/hosts on each lookup, for example.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2015

What kinds of names are in the /etc/hosts file in Docker? Do they look like fully-qualified names? It would be nice to avoid stat'ing the /etc/hosts file for all the regular DNS lookups. But if we had some way to tell, from looking at the name, that it was likely to come from /etc/hosts, we could make the lookup more aggressive about noticing changed /etc/hosts in that case.

@rsc rsc added this to the Go1.6Maybe milestone Dec 28, 2015

@dtjm

This comment has been minimized.

Copy link
Author

commented Jan 3, 2016

The hostnames could be arbitrary, so I don't think you could tell from just looking at the hostname.

stat'ing the host file on every DNS lookup seems pretty expensive. But if we stat'ed the /etc/hosts file, say, every 5 or 10 seconds, that would be a big improvement over waiting 5 minutes.

@gopherbot

This comment has been minimized.

Copy link

commented Jan 6, 2016

CL https://golang.org/cl/18258 mentions this issue.

@rsc rsc closed this in b598a7f Jan 6, 2016

@golang golang locked and limited conversation to collaborators Jan 7, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.