[Bug libc/3675] New: libc caches resolv.conf forever

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/3675] New: libc caches resolv.conf forever

fweimer at redhat dot com
Relevant libc extension: BIND-8.2.3-T5B

libc apparently reads /etc/resolv.conf upon the first access to getaddrinfo()
and parses it and continues with the parsed results forever, even if
/etc/resolv.conf changes. There is no documented interface to cause libc to
re-read the resolv.conf file.

Real-world problem: Processes designed to run for many days will not detect
resolv.conf changes. On systems without permanent internet connection,
resolv.conf may be rewritten by unrelated DHCP client or PPP peer software after
an application using getaddrinfo() has started. The result is that errors such
as EAI_AGAIN that stem from stale /etc/resolv.conf parsed at application
start-up time persist until the application terminates.

Suggested solution: be sure to check /etc/resolv.conf for changes and, when
changes are detected, re-parse it every few (say, 5) seconds, or when EAI_AGAIN
would be returned. The time limit should bound the amount of time spent parsing
said fail without introducing too much delay WRT picking up changes.

Checking for resolv.conf changes upon EAI_AGAIN is clearly my favorite.

--
           Summary: libc caches resolv.conf forever
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: matthias dot andree at gmx dot de
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3675

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/3675] libc caches resolv.conf forever

fweimer at redhat dot com

------- Additional Comments From drepper at redhat dot com  2006-12-07 15:17 -------
That's what res_init() is for, call it.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


http://sourceware.org/bugzilla/show_bug.cgi?id=3675

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/3675] libc caches resolv.conf forever

fweimer at redhat dot com
In reply to this post by fweimer at redhat dot com

------- Additional Comments From matthias dot andree at gmx dot de  2006-12-07 15:22 -------
Thank you. Could you confirm that res_init() does:

- *not* look at the RES_INIT state (i. e. re-reads resolv.conf every time it is
called), and
- *not* leak memory when called frequently?


--


http://sourceware.org/bugzilla/show_bug.cgi?id=3675

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.