http://bugzilla.spamassassin.org/show_bug.cgi?id=4278





------- Additional Comments From [EMAIL PROTECTED]  2005-04-27 14:37 -------
I have more information and a patch. Just using Net::DNS::Resolver->search is
not the right answer.

The immediate cause of the problem was in Net::DNS in the Win32 and Cygwin
versions. They get a list of nameservers to try from the Windows registry, which
contains a list of network interfaces and the nameservers for each one. I was
using a WiFi PC card on my laptop which also has a wired ethernet port that was
not plugged in. The registry entry for the wired interface still contained the
ip address of the nameserver that was provided by DHCP the last time it had been
plugged in. That nameserver ip address was first in the list of nameservers put
together by Net::DNS.

Net::DNS::Resolver->search tries each nameserver on the list in turn, with
settable options for number of retries and progressively long timeouts. Thus it
was immune to the bad nameserver address at the head of the list.

Background queries have to use only the first nameserver, so they fail.
DnsResolver->search is written to use a background query and to poll for a
result with no timeout. With the first nameserver being bad, that caused an
endless loop.

NOTE: This bug is not specific to Win32 and Cygwin as far as I can tell. The
same problem should occur on any system if Net::DNS has a list of nameservers
and the first one is down when you run SpamAssassin. If Net::DNS on Unix is
smart about initializing the nameserver list it might not be likely, but still
could happen if access to the first nameserver crashes after it has been put on
the list and before the DNS availability test in Dns.pm.

Here are the fixes I'll upload as patches when I get a chance. I've already
written and mostly tested them:

Net::DNS::Resolver Win32 and Cygwin modules should be fixed to ignore the
adaptors whose registry entries specify an ip address of 0.0.0.0. I'll submit
patches upstream, but we should make our code proof against similar problems
that can occur wihtout the bug in Net::DNS, such as if the primary nameserver is
down.

Mail::SpamAssassin::Dns.pm should be changed so that the test for DNS
availability is done on each nameserver in Net::DNS::Resolver->nameservers, with
an appropriate timeout and removing unresponsive nameservers until a good one is
found or the list is emptied. This will allow the use of background queries
during the rest of the processing.

DnsResolver->search should continue to use background queries, but be changed to
have a timeout. That was in the TODO comments for that anyway, and the patch was
pretty simple. With the tinmeout it will have the correct behaviour to be used
by the DNS availablility test in Dns.pm, as described in the previous paragraph.

Patches to be attached after I spend some time on work and school.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to