net: lookupStaticHost caches for too long for Docker #13340
Comments
Maybe instead of configurable it just needs a better default. It could stat /etc/hosts on each lookup, for example. |
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. |
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. |
CL https://golang.org/cl/18258 mentions this issue. |
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.
The text was updated successfully, but these errors were encountered: