Red Hat Bugzilla – Bug 20463
gethostbyname() caches the IP of the DNS server
Last modified: 2007-04-18 12:29:43 EDT
I have noticed this when running two gnome applets, gnomeicu and gweather.
I was also told that this happens with netscape and in that case it
problably happens everywhere.
If you start the applet (gnomeicu in this case) and connect to the server
and then shut down the network and plug in the computer to some other
network (with a different nameserver),
the applet cannot resolve any names anymore because the old nameserver ip
is cached somewhere.
You have to restart the applet to get it working again.
A bit bothersome when you are using a laptop in different locations.
I've also seen this problem, for the same reason. (Roaming laptop.) This "bug"
has been there for at least a couple years, so I'm not sure it's technically a
bug. (After all, I can't find anything that suggests that changing resolv.conf
will affect running programs.)
Regardless, the behavior is very annoying. Only way I know offhand to rectify
this is to turn off pump's writes to resolv.conf and install a caching bind. It
would be nice if this weren't necessary.
This has been actually discussed on libc-hacker mailing list
and was decided that users can use nscd and thus there is no need
to add overhead of additional syscall per name resolution (some *stat
to check whether resolv.conf was updated).
So install nscd and whenever you make changes to resolv.conf,
simply /etc/init.d/nscd restart.