SA times out

Julian Field MailScanner at
Fri Apr 4 22:50:44 IST 2008

Kai Schaetzl wrote:
> Julian Field wrote on Fri, 04 Apr 2008 17:23:15 +0100:
>> The command-line SA calls the Mail::SpamAssassin perl module to do all 
>> the hard work.
> But why is it then much faster? At least for this message. I notice that 
> when I debug with MS it first scans some default message, maybe the one SA 
> scans when using "spamassassin -D --lint", only then it grabs a message 
> from the queue. Does this only happen with MS in debug mode?
SpamAssassin (by design) has 'compile_once' functionality. This forces 
Perl to load all the functions required for its operation, and therefore 
compile them, so that all future messages are processed at the same 
speed. It implements this by processing a dummy message and throwing 
away the result. SpamAssassin, like many Perl modules, only loads and 
compiles the code of functions when they are used for the first time, 
thereby greatly improving the startup speed and memory footprint of 
large modules. In Perl terminology, it is called the Dyna-Loader. So to 
force this to happen, you have to execute all the functions once. 
SpamAssassin does this by working out the spam score for a dummy message.

This is what you see happening when you have --debug-sa specified on the 
MailScanner command-line.

Hopefully that explains what you see happening.


Julian Field MEng CITP CEng
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key:

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the MailScanner mailing list