[Mimedefang] Mimedefang sometime doesn't timeout Mail::SpamAssassin::Timeout parts in SA plugins

Martin Blapp mb at imp.ch
Thu Apr 13 09:28:57 EDT 2006

Hi David,

This Plugin works in Spamassassin, but in mimedefang sometimes some of the 
timeouts get ignored. This explains also the hanging helper utilities, pyzor, 
dcc, ocr etc I've experienced in the past.

The strange thing is that it only happens sometimes and the helper utils
always use a lot of CPU in those cases.

Any idea how to solve this problem ? Maybe its still a SA problem and
only happens sometimes (if the server is busy) ?

[38115] dbg: plugin: loading bugtest from /plugins/test.pm
[38115] dbg: plugin: registered bugtest=HASH(0x8dd058c)
[38115] dbg: plugin: bugtest=HASH(0x8dd058c) implements 'parsed_metadata'
[38115] dbg: bugtest: Set timeout to 10 seconds
[38115] dbg: bugtest: Before sleep of 100 seconds
[38115] dbg: bugtest: After timeout of 10 seconds

I suspect that some signal problems between Mdefang and SA. Maybe Mdefang
ignores some signals and SA doesn't receive anything back. Btw, I'm using
embedded perl 5.8.8.

package bugtest;
use strict;
use Mail::SpamAssassin;
use Mail::SpamAssassin::Plugin;
use warnings;
use bytes;

our @ISA = qw(Mail::SpamAssassin::Plugin);
sub dbg { Mail::SpamAssassin::dbg (@_); }

sub new {
         my ($class, $mailsa, $server) = @_;
         $class = ref($class) || $class;
         my $self = $class->SUPER::new($mailsa);
         bless ($self, $class);
         return $self;

sub parsed_metadata {
         my ($self, $opts) = @_;
         my $permsgstatus = $opts->{permsgstatus};

         dbg("bugtest: Set timeout to 10 seconds");
         my $timer = Mail::SpamAssassin::Timeout->new({ secs => 10 });
                 my $err = $timer->run_and_catch(sub {

 		# Or do something that loads this slave a lot !
                 dbg("bugtest: Before sleep of 100 seconds");
                 system("sleep 100");
                 dbg("bugtest: After sleep of 100 seconds");
         dbg("bugtest: After timeout of 10 seconds");


Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E

More information about the MIMEDefang mailing list