All,

Since migrating to Postfix+Amavisd-new+SpamAssassin+ClamAV a few months
back, I've had some issues with amavisd-new going out of control and
consuming a massive amount of CPU time. The load on my box is normally
less than 0.8, but when amavisd-new goes crazy, the load will climb to
over 7 and will sometimes get to over 10.

The work-around that I've patched together is a total hack, but it
works. Here's the script that I run every 5 minutes from cron.

#!/bin/sh

### Get the current load in integer form. (using truncate, not round)
LOAD=`/usr/bin/uptime | \
       /usr/bin/awk '{print $11}' | \
       /usr/bin/cut -f1 -d.`

if [ ${LOAD} -gt 1 ]; then
   echo "Mail IDs Put On Hold:"
   echo

   ### Find IDs in the queue:wq
   IDS=`/usr/bin/mailq | \
     /usr/bin/tail -n +2 | \
     /bin/grep -v '^[-( ]' | \
     /usr/bin/awk '{print $1}' | \
     /bin/grep -v '!$' | \
     /usr/bin/tr -d '*!'`

   for id in ${IDS}; do
     echo $id
     /usr/sbin/postsuper -h $id
   done

   echo "Running amavisd-nanny for 3 minutes to clean up stuck processes."
   /usr/local/bin/limit 180 /usr/sbin/amavisd-nanny 1>/dev/null 2>/dev/null
fi

The limit program is from chapter 13 of Unix for Programmers and Users
(3rd ed.) and the code is available here:
ftp://ftp.prenhall.com/pub/esm/the_apt_series.s-042/glass_ables_unix-3e/expanded/ch13/

It basically waits for X seconds (in this case 180) and if the program
is still running after X seconds, it kills it. This allows me to run
amavisd-nanny for 3 minutes without direct user intervention.

This script will find all messages in the non-hold queue, and get thier
postfix IDs. Then it will put the messages on hold, so that I can check
them out at a later date.

I have a few examples of emails that are causing problems, and then only
common identifier that I can find is that there seems to be some form of
double-byte characters in them.. I think. In places where I expect '=',
I see '=3D' in the postcat output. There are also several '=20'
scattered about the postcat output as well.

I feel that this is a major bug in amavisd-new since a process will lock
up until amavisd-nanny comes along to kill it off (or you manually 'kill
-9' the process.)

Does anyone know of a work-around for this issue, or better yet, a
solution to keep it from happening in the first place?

Version numbers for all software:
Base OS: Ubuntu Server 7.10
postfix: 2.4.7-1
amavisd-new: 2.4.2-6.2
clamav: 0.91.2-3
spamassassin: 3.2.4-0

Thanks!

-- 
John Evans
Administrator of kilnar.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to