getaddrinfo performance problems

Rich Felker dalias at aerifal.cx
Mon Apr 16 15:48:45 UTC 2012


On Mon, Apr 16, 2012 at 03:05:54PM +0100, Ed W wrote:
> Hi, I'm suffering extreme performance problems with getaddrinfo
> being used by ipset to do conversions from IP textual strings to
> number.  Although the IP address is textual there is a reverse DNS
> lookup performed and in the event that my resolver is slow, this is
> sometimes taking 60seconds or so to return

I have not looked at the source, but I suspect this is a uClibc bug
based on a misreading of the standard. Many incorrect historical
getaddrinfo implementations performed unnecessary reverse dns lookups
to fill in the ai_canonname field of the addrinfo structure. POSIX is
very clear that this is wrong:

  A numeric host address string is not a ``name'', and thus does not
  have a ``canonical name'' form; no address to host name translation
  is performed. See below for handling of the case where a canonical
  name cannot be obtained.

Source:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html

Rich


More information about the uClibc mailing list