1

Topic: How I got Amavis + ClamAV stable

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.8
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Debian 12
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MYSQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? nope
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi All,

Just posting this here in case another user encounters similar issues as myself. Bit of background, I run a small mailserver for my domain and have used iRedmail since about 2009 to do so. I rebuild my mail server instead of upgrading between major Linux releases. End result was a very nice new (and shiny) iRedmail 1.6.8 on Debian 12. I have also upgraded roundcube to the latest version 1.6.6. 4GB RAM and 7GB swap.

All was going well but amavis would sporadically stop/deactivate which required manual restarting and then a flushing the postfix queue as a few hours would pass before I would catch on. Things work work fine and then the same thing would happen.

As had been noted in the forums in the past, ClamAV appeared to be the culprit. However, as all the fixes noted have been included in the current version, I was left scratching my head a bit. I have the RAM requirement met and also added SWAP to cover any out of memory issues.

After many hours of tinkering, playing with swappiness settings and just general head scratching. I came across modoboa/issues/2475 post on github from 2022 that seemed to resonate with me and the issues I was seeing.

It would appear that the default amavis settings in Debian set the child processes to 1. For reasons noted in the post that I agreed with I went ahead and adjusted the config as follows:

/etc/amavis/conf.d/50-user

$max_servers = 2;

/etc/postfix/master.cf

smtp-amavis unix - - n - 2 smtp

These settings have resulted in amavis being stable for mutiple days now without deactivation/crashes.

The settings above are worth a shot if you have similar issues

Cheers
Mark

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: How I got Amavis + ClamAV stable

FYI https://docs.iredmail.org/concurrent.processing.html

The cause is ClamAV (not Amavisd), it requires more and more memory these years.
So for a low traffic mail server, reduce the concurrently processed messages to just 1 is an ideal and acceptable solution.