When Spamassassin Gets Power Hungry
Background
Sometimes, not so much since Deanna tuned it, but in back in the bad 'ole days, spamd would hog all the CPU cycles.
We have a sneaking suspicion that spamd/spamc is what is causing sarai
to go absolutely nuts with CPU utilization. In the past three days
that sarai has been up we've witnessed the load shoot up to over 50
due to spamd processes. The only way to tame that load is to do an
/etc/init.d/spamassassin stop and if that doesn't work a killall
spamd. After all the spamassassin processes are stopped then load
retunrs to normal. Once we start spamassassin back up, things are fine
again. I suspect that any emails being processed by spamassassin when
it is killed, as well as any emails coming in while spamassassin is
down, are lost.
It is very hard to always be at the computer available to kill off
spamassassin when it goes haywire... fortunately we've had toni,
matze, stefani, jb and myself paying attention to it and taming the
beast when it rears its head. I installed a program called "VeryNice"
tonight which is supposed to dynamically adjust the nice-level of
proceses which go out of control. I've configured it to know
/usWe have a sneaking suspicion that spamd/spamc is what is causing sarai
to go absolutely nuts with CPU utilization. In the past three days
that sarai has been up we've witnessed the load shoot up to over 50
due to spamd processes. The only way to tame that load is to do an
/etc/init.d/spamassassin stop and if that doesn't work a killall
spamd. After all the spamassassin processes are stopped then load
retunrs to normal. Once we start spamassassin back up, things are fine
again. I suspect that any emails being processed by spamassassin when
it is killed, as well as any emails coming in while spamassassin is
down, are lost.
priority. As it starts behaving again, accumulating good karma, it
then bumps up its priority to a more normal level. If it goes haywire
it kills it.
I am not sure if this will work on spamassassin or not. I had to do
some tweaking to the source to get it to work (it would consider any
process that was spawed off of root to be immune, and spamassassin is
root spawned), and I haven't been able to see it in action.
This is not a perfect solution, figuring out what is causing
spamassassin to eat CPU is the best solution... maybe we need to set
it to work only on certain sized files (maybe big files, with
attachments? are causing the problem?), or maybe it is choking on
massive spam -- when some spambot sends mail to every list at once. I
dont know, but it needs to be figured out!
Solution
It had been driving the load of sarai up to 20, and climbing, fortunately I was online and on sarai. To get it to return to a normal state I did:
/etc/init.d/spamassassin stop
one or two times, while watching the process list with:
top -n 1
It didn't want to stop nicely, so I ended up issuing a few:
killall spamd
Inbetween those, you can quickly check how many processes are still there:
ps aux | grep spamd | wc -l
Once I saw in top that spamd was no longer running and the load was going down I started spamd up again:
/etc/init.d/spamassassin start
--
ChristopherMitchell - 02 Jun 2002