When my server load was running high for a long time I could see from the list of running processes that amavis / clamd were hogging the CPU time.
Researching the problem on the internet gave few clues as to what the problem was and more importantly, what was the fix.
This is the fast solution:
systemctl stop clamd.service
rm -f /var/run/clamd.amavisd/clamd.sock
systemctl start clamd.service
It seems that clamd was unable to open the appropriate socket. I guess removing the file clamd.sock allowed it to find an available one.
If that doesn’t work, check the postfix log for clues as to why Clamd might be misbehaving. The file can be found by using the following command in Terminal:
tail -100 /var/log/maillog | grep clamd
The maillog file contains entries relating to Postfix, Opendkim, Spamassassin and Amavis as well as Clamd.The grep element of the above command filters all log entries that contain the string ‘clamd’ so it’s easier to find the cause of the problem.