Bug 179271

Summary: spamd: SPF: lookup failed: Can't locate object method "type" via package "Net::DNS::RR::TXT"
Product: [Fedora] Fedora Reporter: Aleksander Adamowski <bugs-redhat>
Component: perl-Net-DNSAssignee: Jason Vas Dias <jvdias>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: perl-devel, steve, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-20 17:18:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
log from SPF test suite 'tests_single' run
none
spamassassin-3.0.4-2.fc4's /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/Plugin/SPF.pm modified to log more debug info on SPF query failures none

Description Aleksander Adamowski 2006-01-29 14:32:45 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050923 Fedora/1.7.12-1.5.1

Description of problem:
On an Opteron (x86_64) server, Spamassassin's spamd logs the following error messages every now and then:

Jan 28 21:13:06 nmail spamd[2082]: SPF: lookup failed: __alarm___BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 5, <GEN21> line 32._Compilation failed in require at (eval 55) line 3, <GEN21> line 32. 
Jan 28 21:16:26 nmail spamd[2073]: SPF: lookup failed: __alarm___BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.6/Text/ParseWords.pm line 3, <GEN28> line 32._Compilation failed in require at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 8, <GEN28> line 32._BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 8, <GEN28> line 32._Compilation failed in require at (eval 56) line 3, <GEN28> line 32. 
Jan 28 21:20:33 nmail spamd[2078]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 61) line 3, <GEN39> line 32. 
Jan 28 21:21:28 nmail spamd[2071]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 58) line 3, <GEN87> line 33. 
Jan 28 21:22:14 nmail spamd[2084]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 58) line 3, <GEN111> line 32. 
Jan 28 21:27:00 nmail spamd[2082]: SPF: lookup failed: Can't locate object method "new" via package "Net::DNS::RR::TXT" at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR.pm line 260, <GEN118> line 53. 
Jan 28 21:27:38 nmail spamd[2071]: SPF: lookup failed: Can't locate object method "type" via package "Net::DNS::RR::TXT" at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SPF/Query.pm line 1295, <GEN166> line 79. 
Jan 28 21:27:44 nmail spamd[2082]: SPF: lookup failed: Can't locate object method "new" via package "Net::DNS::RR::TXT" at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR.pm line 260, <GEN136> line 79. 
Jan 28 21:35:21 nmail spamd[2072]: SPF: lookup failed: __alarm___BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 8, <GEN228> line 79._Compilation failed in require at (eval 90) line 3, <GEN228> line 79. 
Jan 28 21:38:52 nmail spamd[2080]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 99) line 3, <GEN246> line 32. 
Jan 28 21:39:00 nmail spamd[2069]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 115) line 3, <GEN255> line 32. 
Jan 28 21:39:05 nmail spamd[2072]: SPF: lookup failed: Can't locate object method "new" via package "Net::DNS::RR::TXT" at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR.pm line 260, <GEN262> line 33. 
Jan 28 21:40:02 nmail spamd[2083]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 100) line 3, <GEN274> line 33. 
Jan 28 21:42:50 nmail spamd[2070]: SPF: lookup failed: __alarm___Compilation failed in require at (eval 91) line 3, <GEN264> line 303. 
Jan 28 21:43:00 nmail spamd[2075]: SPF: lookup failed: __alarm___BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 8, <GEN279> line 303._Compilation failed in require at (eval 117) line 3, <GEN279> line 303. 
Jan 28 21:45:54 nmail spamd[2070]: SPF: lookup failed: Can't locate object method "type" via package "Net::DNS::RR::TXT" at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SPF/Query.pm line 1295, <GEN282> line 79. 
Jan 28 21:54:57 nmail spamd[2074]: SPF: lookup failed: __alarm___BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR/TXT.pm line 8, <GEN317> line 35._Compilation failed in require at (eval 104) line 3, <GEN317> line 35. 
Jan 28 21:55:24 nmail spamd[2082]: SPF: lookup failed: Can't locate object method "new" via package "Net::DNS::RR::TXT" at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Net/DNS/RR.pm line 260, <GEN293> line 36. 


Version-Release number of selected component (if applicable):
perl-Net-DNS-0.49-2, perl-5.8.6-22, spamassassin-3.0.4-2.fc4

How reproducible:
Sometimes

Steps to Reproduce:
1. Install FC4 and the latest updates on an x86_64 machine
2. Launch SpamAssassin
3. Send some mail from the outside world (untrusted networks) to it
4. Watch the maillog

Actual Results:  The above errors are logged.

Expected Results:  No errors are logged and SPF rules are run by SpamAssassin.

Additional info:

Comment 1 Jason Vas Dias 2006-01-29 18:39:27 UTC
These errors would appear to be coming from the Mail::SPF::Query package,
when spamassassin's Plugin/SPF.pm eval's the Mail::SPF::Query's ->query() method.

Did you get the Mail::SPF::Query package from Fedora Extras? 

Which version of  Mail::SPF::Query are you using ?

Mail::SPF::Query would appear to depend on quite a few other packages, some of
which are not in Fedora Extras:

Net::CIDR::Lite: in Extras as perl-Net-CIDR-Lite-0.18-2.fc4
Sys::Hostname::Long ( not in Extras at all )

What versions of these packages are you using ? Did you install them from Extras
or from CPAN ?



Comment 2 Paul Howarth 2006-01-30 07:45:26 UTC
(In reply to comment #1)
> Mail::SPF::Query would appear to depend on quite a few other packages, some of
> which are not in Fedora Extras:
> 
> Net::CIDR::Lite: in Extras as perl-Net-CIDR-Lite-0.18-2.fc4
> Sys::Hostname::Long ( not in Extras at all )

The Extras version of Mail::SPF::Query was patched not to need/use
Sys::Hostname::Long. Other than that, all of the necessary dependencies are
available from Core or Extras. Otherwise, the package would never have passed
review (and I was the reviewer).



Comment 3 Aleksander Adamowski 2006-01-30 12:40:04 UTC
I'm using perl-Mail-SPF-Query-1.997-4.fc4 from extras.

I've only installed the following packages from CPAN:

Net::XMPP
Net::Jabber
Log::Log4perl



Comment 4 Aleksander Adamowski 2006-01-30 12:41:58 UTC
This didn't include CPAN dependencies, but from inspecting my ~/.cpan/build, I
can see only those modules were built:

Archive-Tar-1.26
Bundle-libnet-1.00
Compress-Zlib-1.41
CPAN-1.80
Digest-MD5-2.36
Log-Log4perl-1.02
Net-Jabber-2.0
Net-Telnet-3.03
Net-XMPP-1.0
PathTools-3.14
TermReadKey-2.30
Term-ReadLine-Perl-1.0203
XML-Stream-1.22


Comment 5 Jason Vas Dias 2006-01-30 18:56:39 UTC
Well, having a look at the Mail::SPF::Query package, I'm not sure it is working
correctly at all.

I downloaded the http://www.schlitt.net/spf/tests/ "SPF Test Suite", and 
EVERY test failed - not one test was successful - even after editing the
tests to fix the broken '-sanitize=1 and -debug=1' spfquery arguments.
Test log attached.

Hence, it appears Mail::SPF::Query is not up to the job - removing it :
  $ rpm -e perl-Mail-SPF-Query
will resolve this bug.

Comment 6 Jason Vas Dias 2006-01-30 18:58:44 UTC
Created attachment 123875 [details]
log from SPF test suite 'tests_single' run

Comment 7 Jason Vas Dias 2006-01-30 19:05:01 UTC
What happens when you run some of the commands from the SPF test suite log 
above - eg:

# spfquery -default-explanation=explanation -sanitize -debug -ip=192.0.2.11
  -sender=10.spf1-test.mailzone.com -helo=10.spf1-test.mailzone.com

Do you get a perl error ?


Comment 8 Aleksander Adamowski 2006-01-30 21:01:52 UTC
Seems OK (BTW, it didn't accept plain "-debug", it needs a numeric argument,
e.g. "-debug 1"):

[root@nmail tests_v2.1]# ./spfquery.pl.pre-1.997
-default-explanation=explanation -sanitize -debug 1 -ip=192.0.2.11
-sender=10.spf1-test.mailzone.com -helo=10.spf1-test.mailzone.com
|         10.spf1-test.mailzone.com new: ipv4=192.0.2.11,
sender=10.spf1-test.mailzone.com, helo=10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com localpart is postmaster
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet override: is
10.spf1-test.mailzone.com in the override hash?
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet override: is
*.spf1-test.mailzone.com in the override hash?
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet override: is
*.mailzone.com in the override hash?
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet override: is *.com
in the override hash?
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet override: is *. in
the override hash?
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet->new(): doing TXT
query on 10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com   myquery: doing TXT query on
10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet->new(): TXT query
on 10.spf1-test.mailzone.com returned error=, last_dns_error=NOERROR
|        postmaster 10.spf1-test.mailzone.com   DirectiveSet->new(): SPF policy:
 mx                                          -all
|        postmaster 10.spf1-test.mailzone.com   lookup:   TXT  mx              
                           -all
|        postmaster 10.spf1-test.mailzone.com   lookup:   TXT prefix=+, lhs=mx, rhs=
|        postmaster 10.spf1-test.mailzone.com   lookup:   TXT prefix=-, lhs=all,
rhs=
|        postmaster 10.spf1-test.mailzone.com   lookup:  mec mechanisms=+mx() -all()
|        postmaster 10.spf1-test.mailzone.com   evaluate_mechanism: +mx() for
domain=10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com   myquery: doing MX query on
10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com   myquery: doing A query on
mx01.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com   mechanism mx: we have a match;
10.spf1-test.mailzone.com MX mx01.spf1-test.mailzone.com A 192.0.2.11 == 192.0.2.11
|        postmaster 10.spf1-test.mailzone.com   evaluate_mechanism: +mx()
returned hit 10.spf1-test.mailzone.com MX mx01.spf1-test.mailzone.com A 192.0.2.11
|        postmaster 10.spf1-test.mailzone.com   saving result pass to cache
point and returning.
|        postmaster 10.spf1-test.mailzone.com header_comment: spf_source =
domain of 10.spf1-test.mailzone.com
|        postmaster 10.spf1-test.mailzone.com header_comment: spf_source_type =
original-spf-record
pass
explanation: 10.spf1-test.mailzone.com MX mx01.spf1-test.mailzone.com A 192.0.2.11
spfquery: domain of 10.spf1-test.mailzone.com designates 192.0.2.11 as permitted
sender
Received-SPF: pass (spfquery: domain of 10.spf1-test.mailzone.com designates
192.0.2.11 as permitted sender) client-ip=192.0.2.11;
envelope-from=10.spf1-test.mailzone.com; helo=10.spf1-test.mailzone.com;


Comment 9 Jason Vas Dias 2006-02-09 22:06:47 UTC
Created attachment 124461 [details]
spamassassin-3.0.4-2.fc4's /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/Plugin/SPF.pm modified to log more debug info on SPF query failures

I think these SPF lookup failures are occuring when the DNS lookups timeout / 
fail, possibly due to intermittent loss of network connectivity.

Here's an SPF.pm that will log more info when these failures occur that should
give us a better idea of their cause. 

Please copy the attached SPF.pm to
/usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/Plugin/SPF.pm ,
restart spamd, and then grep for the log messages it might output:
  # egrep '(SPF: failed query:)|(SPF: DNS connectivity)' /var/log/messages
and append such messages to this bug report if found - thanks!

Comment 10 Jason Vas Dias 2006-02-20 17:18:54 UTC
I've now been running spamassassin with the Mail::SPF plugin installed on my
inbox on an FC-4 system with all the latest updates installed, without a 
single occurrence of this problem.
I think this problem is simply due to intermittent DNS network service failures
occurring leading to a timeout and the alarm signal handler firing, failing the
DNS query. 
Hence, this is being closed as NOTABUG.