MailScanner Spamassassin fills disc with bayes_toks.expire* files

This is being caused because the Bayes auto-expire takes too long to run and is being killed. Check your mail logs for “SpamAssassin timed out and was killed” messages, this indicates the kill.

Possible solutions;

  • You could resolve this by increasing the Spamassassin Timeout in MailScanner.conf. I do not recommend this, as you never know how long it will run (it can really take long) and end up with the same problem sooner or later.
  • Run sa-learn as a daily cron;
    0 0 * * * /usr/bin/sa-learn --force-expire
    Disable auto expire in /etc/MailScanner/spam.assassin.prefs.conf (bayes_auto_expire 0)
    This proved to be the best solution.

The bayes_toks.expire* files are orphaned files because of the sa-learn process being killed. They will not be removed by running sa-learn! Remove them manually.