procmail fails to write to large mailbox

by on May.15, 2007, under Linux, System Administration

Okay, I’ve been having strange problems where procmail will suddenly stop moving messages to a mailbox.

It works fine for a while, then (with no changes to the recipes) it’ll suddenly stop moving incoming spam to my spam box.

Looking at the procmail log shows it’s failing to write to the mbox file:

procmail: Error while writing to "spam"
procmail: Truncated file to former size

There appears to be nothing wrong with the spam mbox file, it’s writable by procmail (its permissions haven’t changed).

This has happened a couple of times, and I’ve solved it by renaming the spam mbox file, so that a new one gets created.

I happened to check the previous ones when it happened again today, and the sizes are all the same, which seems a bit too coincidental:

[davidp@supernova:~/INBOX]$ ls -lh spam*
-rw------- 1 davidp users 177K 2007-05-15 09:59 spam
-rw------- 1 davidp users 49M 2007-04-27 11:17 spam-broken
-rw------- 1 davidp users 49M 2007-05-06 21:05 spam-broken-2
-rw------- 1 davidp users 49M 2007-05-15 09:45 spam-broken-3

Bit odd that they’re all 49MB! (The true sizes vary slightly (51215340 bytes, ,51198764 bytes, 51199849 bytes) but not much. This is as you’d expect, as different mails are different lengths, and procmail won’t write half a message to the file, if it fails to write the whole lot it truncates back to the previous size).

I could probably get round this by switching to maildir format, so it uses one file per message… but on a folder that’s going to contain a lot of messages, I feel maildir format is a lot less efficient.

Looks like I’m not the only one – I found a Debian mailing-list post from someone who seems to be having more or less the same problem.

Maybe I should just use archivemail to get rid of older spam – but I’d like to find out why I’m experiencing this problem and find a proper fix. Particularly as it won’t be too long before some of my other mail folders start reaching that kind of size (some mailing list ones in particuar) and I don’t want to have to delete “real” email.

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!