There are a lot of sa-learn processes active slowing down the server until it becomes unresponsive. How can I fix this?

When using top you see sa-learn processes causing high load on the server. This is usually caused when spamassassin or dovecot have problems. This will cause the real-time spam learning sieve filter to loop when it tries to call sa-learn to train a message.

1. Stop the dovecot service:

systemctl stop dovecot

2. Kill any active sa-learn processes (this should bring the server load level back down to normal):

pkill -f sa-learn

3. Note: After you have completed any of the solutions below remember to restart the dovecot service:

systemctl start dovecot

SpamAssassin Problems

You can check that your SpamAssassin config has no errors using the command (It should not return any errors):

spamassassin --lint

Dovecot Problems

This error can also be caused by mailbox dovecot.index.cache files being over the default 512MB limit set by Warden. You can raise the limit vsz_limit as per the KB article:

https://www.danami.com/clients/knowledgebase/193/When-logging-into-webmail-you-are-unable-to-read-email.-How-can-I-fix-the-error-Out-of-memory-service-imap--vsz_limitequals512-MB--you-may-need-to-increase-it-in-the-maillog.html

If you are still having problems after trying both solutions above you can try the options below:

Options To Reduce CPU Usage

Option to use Redis as the Storage Backend

Warden supports using Redis as the Bayes storage engine instead of MySQL (this should speed up sa-learn). This can be found under Warden -> Settings -> Learning Settings -> Storage Settings. Detailed instructions for how to to switch to Redis can be found here.

Option To disable the Real-time Learning

You have the option of disabling the real-time learning under Warden -> Settings -> Learning Settings -> Sieve learning -> uncheck Use IMAP sieve learning and save the page. When the real-time learning is disabled in Warden the system will fall back to the Plesk nightly training task and auto-learning instead. Disabling the real-time learning will have minimal impact on spam training.

  • sa-learn
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How can I fix any statistics generation problems?

Missing the Warden Crontab Entry There is a crontab entry that will update Warden statistics...

How can I fix the error: "milter-reject: END-OF-MESSAGE from..." in the log and found the AV in error (cannot read /etc/clam.d/scan.conf).

Cloudlinux / Imunify360 added their own version of ClamAV to their repo which accidentally...

How can I fix the error: Can't connect to TCP port 10024 on ::1 [Cannot assign requested address] when trying to start Amavis?

When trying to start Amavis you see this in the mail log: Oct 02 03:20:15 condor3648 systemd[1]:...

How can I fix the error: Error [Contentfilter_Settings_Contentfilter]. Message [[QUARANTINEDIR] must be a valid directory?

This error means that Amavis was not installed correctly. Try running the Warden from the command...

How can I fix the error: host 127.0.0.1[127.0.0.1] said: 552 5.3.4 Declared message size (1208029 B) exceeds size limit for recipient?

You can set the message size limit for Amavis under Settings -> Policy Settings -> Misc...