[XML-SIG] 20 second socket.addrinfo() delay in SimpleXMLRPCServer
Mark Bucciarelli
mark@easymailings.com
Fri, 3 Jan 2003 09:23:32 -0500
On Friday 03 January 2003 3:26 am, Martin v. L=F6wis wrote:
> Mark Bucciarelli <mark@easymailings.com> writes:
> > How can I debug what's happening in the _socket.getaddrinfo() method?
>
> You probably need to debug it on the C level. Most likely, you'll find
> that getaddrinfo jumps into the DNS resolver code of libc, at which
> point you can only debug it through recording the IP packets send by
> your machine.
>
> If you try to resolve the same host names interactively (e.g. by
> passing them to traceroute), does that work better?
The domain name is localhost. Traceroute returns immediately. However, =
when=20
I was experiencing the 20s delay this morning, I tried using 127.0.0.1=20
instead of localhost, and voila--it returned without delay. So I guess=20
something is messed up with my host name lookup. Strange, I have a 127.0=
=2E0.1=20
localhost entry in my /etc/hosts file.
[...]
> Likely none of these, although 20s does ring a bell: On Linux, name
> lookups are cached through nscd, which is configured through
> nscd.conf, which usually has a line
>
> =09negative-time-to-live=09hosts=09=0920
>
> This says that negative lookups (host not found) stay 20s in the cache
> until they are revalidated. I'm at a loss as to why this would cause
> getaddrinfo to block for this timeout, though.
I uncommented the log file and set debug level to 5 and restarted nscd. =
Of=20
course right now, there is no delay :( and the log looks normal--at firs=
t,=20
localhost is not in cache, and then a bit later, it is.=20
3035: handle_request: request received (Version =3D 2)
3035: GETHOSTBYNAMEv6 (localhost)
3035: Haven't found "6c6f:6361:6c68:6f73:7400:0:fa98:153e" in hosts cache=
!
3035: handle_request: request received (Version =3D 2)
3035: GETHOSTBYNAME (localhost)
3035: Haven't found "localhost" in hosts cache!
3035: handle_request: request received (Version =3D 2)
3035: GETHOSTBYADDR (127.0.0.1)
3035: Haven't found "127.0.0.1" in hosts cache!
=2E..
3034: handle_request: request received (Version =3D 2)
3034: GETHOSTBYNAMEv6 (localhost)
3034: handle_request: request received (Version =3D 2)
3034: GETHOSTBYNAME (localhost)
3034: handle_request: request received (Version =3D 2)
3034: GETHOSTBYADDR (127.0.0.1)
[...]
> Regards,
> Martin
Thanks so much for your help!
Mark