Unnecessary DNS queries in Konqueror (second part of BR#88855)
Dawit A.
adwa at cox.net
Tue Oct 12 14:03:18 BST 2004
On Monday 11 October 2004 10:10, you wrote:
> Dawit A. wrote:
> >Is there any reason why we do a DNS query even when the host is listed in
> >the /etc/hosts file ? We even do a lookup for "localhost" !!! Why ? This
> > was really a surprise to me, but tcpdump confirms that it does indeed
> > happen. Thiago any comments on this ?
>
> "localhost" is special-cased. It's handled by our code directly. There
> should never be queries about it.
It does on my system because of the IPv6 lookup. I did not have the IPv6 entry
for localhost. If I add that then the lookup is not done.
> As for hosts in /etc/hosts, blame your glibc for doing the unnecessary
> queries.
>
> The reason that they are done is because we do IPv6 lookups.
> Since /etc/hosts contains only IPv4 addresses, libnss_files.so returns an
> error code of "not found", instead of "found: it doesn't exist". Therefore,
> the query is passed along to libnss_dns.so, which sends the DNS query.
Ahhh... that explains everything. I am glad I asked. I can now be a little
more intelligent when troubleshooting all the autoamtic proxy config
issues. Thanks...
> A test with "kde.org" in Konqueror resulted in the following lookups:
> - query A kde.org
> - query AAAA kde.org
> - response A 80.232.38.131
> - response (probably for AAAA)
> - AAAA kde.org.local.lan
> - response, No such name
> - query AAAA kde.org.macieira.info
> - response, No such name
>
> Then this repeats three more times. Why? Because each ioslave must resolve
> the name again. For a solution for this, see bugs #63088 and #68894.
I read the discussion in those bug reports. Would it not make more sense to
retrofit the KSocket* class with some sort of DNS caching instead ? Perhaps
one can even programtically turn DNS caching on/off when using these low
level functions directly ? I just did not understand why the caching would
have to be done in the scheduler or at the application level. Specially since
it is not only io-slaves that would benefit from this, but also all apps that
directly use the low level classes like the script based proxy
autoconfiguration class (PAC)...
> As for the unnecessary queries, the blame goes to libnss_files and
> libnss_dns. As you can see, the query for "AAAA kde.org" returned NOTFOUND
> from nss_files, so DNS kicked in. Then, the DNS query returned correctly a
> "NOERROR" DNS packet, indicating that the name exists, but has no IPv6
> address.
>
> But, nooo.... nss_dns decided that wasn't good enough and tried appending
> the domains listed in /etc/resolv.conf's search directive.
Yikes! Indeed that is what happens. It is completely nonsense. Shouldn't that
be reported to whomever wrote those libs ?
--
Regards,
Dawit A.
"A prisoner of my own mind"
More information about the kde-core-devel
mailing list