[Mimedefang] SpamAssassin DnsResolver.pm problem with Embedded Interpreter
David Eisner
cradle at umd.edu
Wed Feb 8 15:59:11 EST 2006
David Eisner wrote:
> When I turn on the embed flag, I have two problems.
>
> 1. mimedefang-multiplexor[24534]: WARNING: Something in your Perl
> filter appears to have opened a file descriptor outside of any
> function....
>
> 2. mimedefang-multiplexor[24534]: Slave 0 stderr: dns: sendto()
> failed: at
> /usr/lib/perl5/site_perl/5.8.0/Mail/SpamAssassin/DnsResolver.pm line 320.
> mimedefang-multiplexor[24534]: Slave 0 stderr: dns: select failed: Bad
> file descriptor at
> /usr/lib/perl5/site_perl/5.8.0/Mail/SpamAssassin/DnsResolver.pm line 347.
> last message repeated 8451 times
In case anybody cares, I solved the problem.
Summary: Comment out the following from mimedefang-filter:
# The next lines force SpamAssassin modules to be loaded and rules
# to be compiled immediately. This may improve performance on busy
# mail servers. Comment the lines out if you don't like them.
if ($Features{"SpamAssassin"}) {
spam_assassin_init()->compile_now(1) if defined(spam_assassin_init());
Longer explanation:
When mimedefang-multiplexor runs in embedded mode, mimedefang.pl sources
mimedefang-filter before starting any slaves (this is documented). The
example mimedefang-filter calls spam_assassin_init() (which is in
mimedefang.pl). This, in turn, allocates $SASpamTester, the
Mail::SpamAssassin object. The Mail::SpamAssassin constructor allocates
a resolver:
$self->{resolver} = Mail::SpamAssassin::DnsResolver->new($self);
The problem is that the DnsResolver constructor calls connect_sock,
which opens a socket "to the first nameserver listed /etc/resolv.conf".
This produces error number 1. Later, when the slaves are activated,
this file descriptor gets closed, resulting in error 2.
Maybe a comment in mimedefang-filter should be added, something like:
# The next lines force SpamAssassin modules to be loaded and rules
# to be compiled immediately. This may improve performance on busy
# mail servers. However, it may cause problems when using an embedded
# perl interpreter with some versions of SpamAssassin. Comment the lines
# out if you don't like them.
-David
More information about the MIMEDefang
mailing list