Diagnose a Runaway Zimbra Amavis Worker Without Guesswork

If a Zimbra server shows an amavisd process near 100% CPU, first determine whether one worker is stuck on a message or whether mail volume has simply increased. Check the process, queue, and /var/log/zimbra.log; then, if the worker remains runaway, restart Amavis with Zimbra’s zmamavisdctl command and investigate any recurring message or custom SpamAssassin rule. A restart can briefly interrupt content scanning, so use it after capturing evidence and during a suitable maintenance window when possible.

Zimbra Amavis process status screen showing one busy worker beside idle workers.
Use the worker view to determine whether a single Amavis process is stuck or all workers are handling mail. (Conceptual terminal illustration, not a captured server session.)

1. Confirm what is using CPU

Run these checks as the zimbra account on the MTA host. If your installation uses a different service layout, follow its release-specific Zimbra administrator documentation; do not substitute a generic Linux Amavis service command.

su - zimbra
ps -eo pid,pcpu,etime,args | grep '[a]mavisd'
/opt/zimbra/amavisd/sbin/amavisd-status

The process list tells you whether CPU usage belongs to Amavis and whether one process has accumulated a long elapsed time. The status utility can show what active workers are doing on releases that include it. Zimbra documents the utility and its state codes, but its path and availability can differ by release; check before relying on it:

test -x /opt/zimbra/amavisd/sbin/amavisd-status && /opt/zimbra/amavisd/sbin/amavisd-status -c 10 -w 2

A short burst during a mail spike can be normal. A single worker remaining CPU-bound while other workers are idle, especially alongside repeated deferred messages, is more consistent with a stuck scan. Amavis is the content-filter interface between Postfix and the configured antivirus and antispam scanners, so the CPU reading alone does not identify which component or message is responsible.

2. Look for a message or scan that never finishes

Review recent Amavis events and the Postfix queue before restarting anything:

grep -i amavis /var/log/zimbra.log | tail -n 100
postqueue -p
Illustrative Postfix queue view with active, deferred, and incoming sections.
Check whether mail is accumulating in the active or deferred queue while Amavis is busy. (Conceptual terminal illustration, not a captured server session.)

In the log, compare repeated entries around the same time and look for a scan that starts without a corresponding completion or handoff. Zimbra’s troubleshooting notes describe cases where a SpamAssassin rule does not finish and an incoming message repeatedly returns through the queue. A rising deferred queue can also mean ordinary capacity pressure, so use timestamps and message identifiers to correlate events instead of assuming every queue delay is a bad message. Protect message contents and addresses when sharing logs.

Illustrative Zimbra log view with Amavis scan-start and scan-finish events.
Compare scan starts and finishes in the Zimbra log to spot processing that never completes. (Conceptual terminal illustration, not a captured server session.)

If the problem began after a local SpamAssassin rule or module change, review the custom rules under /opt/zimbra/data/spamassassin/localrules/ and the relevant change history. Back up the local file, revert only the suspected recent change, and retest. Do not edit the generated /opt/zimbra/conf/amavisd.conf directly as a permanent fix: Zimbra’s configuration tools can rebuild managed files. If you need more detail, temporarily raise Amavis logging on the affected MTA:

zmprov ms "$(zmhostname)" zimbraAmavisLogLevel 2
zmamavisdctl restart
grep -i amavis /var/log/zimbra.log | tail -n 100

After collecting the needed evidence, return the setting to its normal level (Zimbra’s troubleshooting reference lists 1 as the default) and restart Amavis so the generated configuration takes effect:

zmprov ms "$(zmhostname)" zimbraAmavisLogLevel 1
zmamavisdctl restart

3. Restart the Zimbra-managed Amavis service

If one worker stays saturated and mail scanning is backing up, a controlled restart is a reasonable recovery step after you have noted the process ID, recent log lines, and queue state. As the zimbra user, run:

zmamavisdctl restart
zmcontrol status

This restarts the content-filter service managed by Zimbra. It can interrupt in-progress scans briefly; Postfix may defer mail while the filter returns. Do not repeatedly kill workers or restart the entire Zimbra stack as a first response. In a multi-MTA deployment, run the check on the host showing the high CPU and confirm which MTA receives traffic before making service changes.

Illustrative terminal view after restarting the Zimbra Amavis service, with CPU trending down.
After a controlled restart, confirm Amavis is running and CPU use returns toward normal. (Conceptual terminal illustration, not a captured server session.)

If the same pattern returns, preserve the affected queue ID and correlate it with Amavis log entries. Zimbra’s debugging reference describes isolating a suspect message for analysis; use the supported queue-management procedure for your Zimbra/Postfix version and test a copy on a separate system where possible. Do not delete queued mail just to clear CPU. If custom rules are not involved, check whether a supported Zimbra update addresses the installed SpamAssassin or Amavis issue, and review antivirus update or scanner errors in the Zimbra logs.

4. Verify mail flow and CPU recovery

After the restart or rule rollback, check service status, active workers, CPU, and queue depth again:

zmcontrol status
ps -eo pid,pcpu,etime,args | grep '[a]mavisd'
postqueue -p
tail -n 100 /var/log/zimbra.log
  • Amavis is running and new messages complete their scan and return to Postfix.
  • The same worker no longer remains at sustained high CPU, and overall CPU trends down after the mail surge passes.
  • The deferred queue stabilizes or drains instead of growing continuously.
  • No repeat loop or matching unfinished scan appears in the recent log entries.

If CPU remains high across several workers, the issue may be throughput, message volume, scanner cost, or host capacity rather than one runaway process. Keep antivirus and spam protections enabled while you diagnose; disabling them changes the server’s security posture and should only be a deliberate, temporary mitigation with an alternative filtering plan.

References

Leave a Comment

How to