aphlor ([info]aphlor) wrote,
@ 2006-08-16 23:35:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Entry tags:spam, woe

Treading softly sucks.

I guess this one is mostly my fault, really.

A few days ago I decided that rigorous enforcement of SpamAssassin on all of my server users was a bit drastic, so retired the configuration and retreated to the hazy reality of receiving close to 40 junk emails per hour.

Typically this grew dull very quickly, at which point I reached for a former mainstay in my mail sanity, procmail.

Past experience with procmail has taught me that it's really easy to lose a lot of mail very quickly. Particularly if something in the configuration file is so hideous that procmail objects in such a foul fashion that the underlying MTA bounces the mail. So after fighting to transform my nice, easy to understand exim filter rules into hideous lists of symbols and regular expressions, I was ready to whip through a test run to see how it all went.

Common sense at this point caused me to put locking in, since retrieving 600-700 messages, eating two processes for procmail and one process for SpamAssassin per delivery and pausing for 5-10 seconds per message whilst various RBLs are consulted. Hence the head filter read:

# spam checking with pamsassassin - filter, so it adds headers
:0fw: spamassassin.lock
* < 262144
|/usr/bin/spamassassin

Sensible, no? Well, it depends on how you look at it. Running fetchmail with a batch limit of 50 messages just to test the water proved that delivering 50 messages takes a hell of a long time if each message eats up to 10 seconds just to check if it is spam or not. Never the less, it'll take a few hours to clear down 600-700 messages at up to 10 seconds per message - and the locking is in place, so I was confident it would pound away on it's own accord.

What I didn't think of is that exim just might think that, since procmail has been spawned and is just hanging around waiting for it's turn to run, it is taking just a wee while to get it's job done. And it's eating up around 2,100 processes in the, err, process.

So after a while it said "that's just taking too damned long. I'll bounce the message. *punt*".

91 punts later and I finally notice that the process table is shrinking too quickly for these to be properly delivered and kill exim, procmail and any SpamAssassin processes left running.

Assessing the damage, I now have 15 mailing lists to check I don't get booted off of in the next fortnight (or whenever the bounce processor/list admin gets around to checking bounces).

There's no moral to this story. Just pity. I will now instruct fetchmail to deliver using procmail from now on and ignore exim entirely for local fetching.




(3 comments) - (Post a new comment)


[info]kernelslacker
2006-08-17 03:58 am UTC (link)
erk, you're starting spamassassin for each mail?
start it as a daemon, and then use ..

:0fw
* < 262144
| /usr/bin/spamc

spamc is a lot more lightweight IME.

(Reply to this) (Thread)


[info]justnine
2006-08-17 07:26 am UTC (link)

During the delivery of all of the crap, I started trying to work out how I could mangle procmail to maintain 10 active spamassassin processes at a time, and eventually found that spamd has a child limitation function.



The procmail rule is pretty much the same as the snippet you've give there.



Using procmail to deliver mail for fetchmail is not a great idea since it waits for procmail to finish delivering before fetching the next mail. So I've gone back to using exim for delivery and hoping the queue clears quickly.



Morning test fetch of nearly 1,000 messages that queued up overnight cleared down in an impressive amount of time - must have been close to 6 minutes all in all.


(Reply to this) (Parent)(Thread)


[info]justnine
2006-08-17 07:27 am UTC (link)
Gah, I need to remember to turn off auto formatting if I'm going to put <p> tags around things.

(Reply to this) (Parent)


(3 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…