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

David F. Skoll dfs at roaringpenguin.com
Thu Apr 13 10:29:41 EDT 2006

Martin Blapp wrote:

> This Plugin works in Spamassassin, but in mimedefang sometimes some of
> the timeouts get ignored.

Does it work if you disable the embedded Perl feature?

> 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.

The multiplexor sets actions for SIGINT, SIGHUP and SIGTERM, which shouldn't
affect SA.  It also sets a SIGCHLD action, but all of these handlers
are reset when it forks a slave:

    signal(SIGTERM, SIG_DFL);
    signal(SIGCHLD, SIG_DFL);
    signal(SIGHUP, SIG_DFL);
    signal(SIGINT, SIG_DFL);
    sigprocmask(SIG_BLOCK, &sigs, NULL);

Timeouts in SpamAssassin are (to the best of my recollection) implemented
with SIGALRM, which by itself is evidence of scariness, but I don't think
MIMEDefang should affect SA.

>         # 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");
>         });

This is an excerpt from the Linux alarm() man page:

       sleep()  may  be implemented using SIGALRM; mixing calls to alarm() and
       sleep() is a bad idea.

I'm not sure if this is true on FreeBSD, but maybe try implementing
your 100-second wait with something like this:

       select(undef, undef, undef, 100);



More information about the MIMEDefang mailing list