Mail server backlogging - seems like a Bayes problem

Matt Kettler mkettler at EVI-INC.COM
Thu Oct 21 20:20:57 IST 2004

At 02:25 PM 10/21/2004, Ron E. wrote:
>Dear All,
>         Hopefully someone has an idea for me - I have a server that
>normally handles it's traffic load but this morning has started
>backlogging - I ran MailScanner in debug mode and the only real point of
>long delay I saw coming up repeatedly is:
>debug: bayes: Can't use estimation method for expiry, something fishy,
>calculating optimal atime delta (first pass)
>debug: bayes: expiry max exponent: 9
>The above messages I have only sometimes seen before when doing a bayes
>database rebuild, but not always.
>Anyone have any ideas why this is happening repeatedly within one
>MailScanner batch and how I can alleviate it?

Any chance MS is timing SA out and killing it repeatedly? (this can happen
if SA does expiry and it takes too long for MailScanner's rather absurdly
short default timeout).

If this is the case, Re-quoting myself from a post to the SA user's list:
In the short term, you can help by running a sa-learn --force-expire on
your bayes DB.

In the longer term, here's some suggestions I use on my own MailScanner
server: (I use all of these together)

1) Increase the spamassassin timeout in MailScanner.conf. Bring it to 60
seconds at least, I have mine set to 120.

2) Set the "Rebuild Bayes Every" parameter in MailScanner.conf. 86400
seconds is a good start. This makes MailScanner invoke SA's bayes
housekeeping directly, rather than during a scan of a message.

3) in /etc/mail/spamassassin/ set: bayes_auto_expire 0. This will
keep SA from trying to run bayes expires (long and slow) during message
handling, but relies on #2 above to allow expiry to occur.

4) I also have a sa-learn --force-expire running as a daily cronjob. I have
tested the setup without this measure, and #2 is sufficient to cause expiry
to occur. Really this is just a fail-safe to allow expiry to occur even if
MailScanner's calls fail to run it properly for some reason.

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ ( and
the archives (

More information about the MailScanner mailing list