getaddrinfo performance problems

Ed W lists at
Mon Apr 16 16:08:39 UTC 2012

On 16/04/2012 16:48, Rich Felker wrote:
> 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:

I have traced it to gethostbyaddr_r in resolv.c.  This function calls 
__dns_lookup recursively

Should we ever be calling dns in here?


More information about the uClibc mailing list