overload issue with procmail and spamassassin

Hey guys,

Im currently experiencing the following issue. When I send a newsletter to my customers some emails get queued on the postfix queue (about 15+ emails every 20min). This isnt a real problem as I know my server is not very cpu powerful enough to handle the amount of send. The thing is that spamassassin starts overloading the server when this happens. If I stop the send, the spamassassni processes (listed below) keep running like if they were scanning the queue. The server load will stay high until I flush the queue, once I done so, they are gone.

Could it be that spamassassin is doing something nasty with the email queue? I assumed it should scan only the incoming emails not the outgoing ones.

This is the spamassassin processes I see on top when the issue stats,

14401 josensr. 25 0 44380 38m 3188 R 33.2 1.9 0:12.50 /usr/bin/perl -T -w /usr/bin/spamassassin --siteconfigpath /etc/webmin/virtual-server/spam/127514725019518

14487 josensr. 25 0 43716 37m 3188 R 30.3 1.9 0:02.82 /usr/bin/perl -T -w /usr/bin/spamassassin --siteconfigpath /etc/webmin/virtual-server/spam/127514725019518

Attached on this post is the procmailrc and /etc/webmin/virtual-server/procmail/127514725019518 config.

Any ideas?

Thanks in advance.

Howdy,

No, it shouldn’t scan outgoing emails. Is it possible some of your messages are bouncing back, and sitting in the queue waiting to be delivered to you? If they bounced back to you, SpamAssassin would in that case scan them.

Alternatively, having outgoing messages queued up in Postfix can raise the CPU load of your server a bit, it takes some CPU power to process that queue.

It’s possible that the SpamAssassin processes you’re seeing are only there because they’re taking longer to run due to having less CPU available.

Having 15 messages in the queue shouldn’t be all that bad. But having 100+ messages in the queue on a server without a lot of available CPU could cause what you’re describing.

One of the ways I’ve solved issues like that is to rate limit outgoing emails for newsletters. Send a batch of 100 emails, stop for 10 minutes, then send another batch (that’s just an example, you’d of course use whatever numbers work well for you). But many newsletter applications (such as phplist) offer rate limit functionality and should make that nice and simple if that’s indeed the issue.

-Eric

Hey Eric,

Thanks for the very quick response.
The thing is the server load will keep high after hours of stopping the newsletter sending.
The spamassassin threads keep re-appearing (with other pids) everytime I kill them. Server load will keep in that state until I flush the queue.

I checked at the email queue and mostly of the emails have been queued for graylisting (try again in 5min) or bounces back due errors.

For example, I start sending the newsletter, when the email queue reaches 15 emails on queue I stop the sending, server load shows high for hours until I flush the queue.

Its quite odd, it seems procmail or spamassassin are doing something nasty.

Which processes exactly are causing the high load? You can check that with top or atop while load is high.

How many messages are you seeing in your queue when you’re running into the high CPU loads? You can determine that from the last line of output when you run “mailq”.

Remember, if a server sends you a bounce message of some kind, SpamAssassin would indeed process it. But it wouldn’t be processing outgoing mail… it takes quite a lot of effort to get a setup like that working :slight_smile:

But for any incoming message (including bounces), procmail would be called, and thus SpamAssassin, for each message.

-Eric

Hello Locutus,

The process are attached on the file I posted here…, see below. Those are usually the top two in “top”.

14401 josensr. 25 0 44380 38m 3188 R 33.2 1.9 0:12.50 /usr/bin/perl -T -w /usr/bin/spamassassin --siteconfigpath /etc/webmin/virtual-server/spam/127514725019518

14487 josensr. 25 0 43716 37m 3188 R 30.3 1.9 0:02.82 /usr/bin/perl -T -w /usr/bin/spamassassin --siteconfigpath /etc/webmin/virtual-server/spam/127514725019518

Eric,

After 5-6 emails on queue I notice the high cpu load and those processes at the top of the process list.

If postfix keeps those emails on queue, the spamassassin process will never die. If it processes the queue successfully, the spamassassin processes will finish.

anyone that could shed some light on this?

One relevant bit of information might be: are you using SpamAssassin as spamd/spamc (daemon sitting in the background, client accessing it) or standalone? How much memory and what CPU does the system have?

Still the initial question is valid: SA should not be scanning outgoing mail, so whatever is causing those SA processes to reappear must be caused by incoming mail.

And mail just being in the queue does not trigger SA processes to appear; those are created by Procmail when Postfix processes a mail.