[distcc] gethostbyname()

Martin Pool martinpool at gmail.com
Wed Oct 13 02:18:42 GMT 2004


On Tue, 12 Oct 2004 12:32:25 +0200, Dimitri Papadopoulos-Orfanos
<papadopo at www.nospam.fr> wrote:
> Hi,
> 
> Function gethostbyname() is a known POSIX flaw. It used not to be
> possible to perform non-blocking calls to the resolver.
> 
> Martin lists the following options:
> 
> 0- just suffer; or rather tell people to fix their nameserver or turn
> down the timeout in resolv.conf
> 
> Martin thinks this is the best option.

That's what I've done in 2.18: if your nameserver is likely to be
unreachable, the system needs to know that itself (e.g. by removing
the route when your laptop is unplugged.)

> That's a bad idea, header resolv.h is part of BIND which covers only
> DNS. Hosts are not always listed in a DNS server. They may be listed in
> NIS or LDAP servers. NIS is sometimes used where I work for example.

OK, I thought so.  This is also likely to be a problem for things like libadns.

> Is there such a library? One that also covers NIS servers and such? On
> the other hand there are proposals for an asynchronous lookup framework:
>         http://people.redhat.com/drepper/asynchnl.pdf
> Why not use getaddrinfo_a() on platforms where it's available? I'm
> pretty sure there are some autoconf macros that cover this function.

That's probably the best option if we want to handle nameserver
timeouts.  It looks like the request needs to be started with
GAI_NOWAIT, and then the timeout is given to gai_suspend.

> Note that mozilla uses lookups in a separate process, so that option may
> be gross but it can't be that bad.

Samba does this too.  Perhaps someone should put it into a library, if
there is not already one.

I know one person asked for this feature previously.  Does anyone else care?

-- 
Martin



More information about the distcc mailing list