"Me too". I just spent half a day tracking down why my Django development server
running under Feisty was taking 20 seconds to serve a simple web page to another
machine on the same LAN, and finally tracked it down to this issue. Specifically,
the client machine was on a private network (IP address 10.0.1.1) and the local
DNS server was configured with an empty 10.in-addr.arpa.zone,
causing it to return an NXDOMAIN response for the reverse mapping.
The django server was calling gethostbyaddr() on the client address (10.0.1.1)
for each HTTP request, and each gethostbyaddr() call took about about five
seconds to complete. On my other, non-Ubuntu machines, it would return almost
instantly (within a few milliseconds).
When I changed the "hosts" line in /etc/nsswitch.conf to
hosts: files dns
the problem went away - the page that took 20 seconds to load now loads
in a small fraction of a second.
It's not reasonable for the lack of a reverse mapping in the DNS to cause a
long delay. On other operating systems, it simply causes the gethostbyaddr()
call to quickly return with h_errno=HOST_NOT_FOUND, and Ubuntu should
behave the same way.
Long delays in gethostbyname() and gethostbyaddr() are of course to be
expected if the DNS server is not responding, but that is not the case
here - the server is responding quickly, but with an NXDOMAIN, indicating
that no reverse mapping exists.
"Me too". I just spent half a day tracking down why my Django development server arpa.zone,
running under Feisty was taking 20 seconds to serve a simple web page to another
machine on the same LAN, and finally tracked it down to this issue. Specifically,
the client machine was on a private network (IP address 10.0.1.1) and the local
DNS server was configured with an empty 10.in-addr.
causing it to return an NXDOMAIN response for the reverse mapping.
The django server was calling gethostbyaddr() on the client address (10.0.1.1)
for each HTTP request, and each gethostbyaddr() call took about about five
seconds to complete. On my other, non-Ubuntu machines, it would return almost
instantly (within a few milliseconds).
When I changed the "hosts" line in /etc/nsswitch.conf to
hosts: files dns
the problem went away - the page that took 20 seconds to load now loads
in a small fraction of a second.
It's not reasonable for the lack of a reverse mapping in the DNS to cause a HOST_NOT_ FOUND, and Ubuntu should
long delay. On other operating systems, it simply causes the gethostbyaddr()
call to quickly return with h_errno=
behave the same way.
Long delays in gethostbyname() and gethostbyaddr() are of course to be
expected if the DNS server is not responding, but that is not the case
here - the server is responding quickly, but with an NXDOMAIN, indicating
that no reverse mapping exists.