Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Has anyone seen the following issue with procmail file lock timeouts when writing to a mbox file? This occurs every couple of weeks for a user with the following procmailrc:

:0 c:     #copy all mail to "bkp"
bkp

Most of the time, this works without issue. Every few weeks, the following message appears in the procmail log:

procmail: Forcing lock on "bkp"
procmail: Timeout, was waiting for "bkp"

Sometimes procmail is able to release the lock (or the lock disappears) before the postfix command timeout occurs (which is now set to an hour). Otherwise the mail delivery fails with:

relay=local, delay=2001, delays=0.78/0.05/0/2000, dsn=5.3.0,
status=bounced (Command time limit exceeded: "procmail -t -f-")

The bkp file is very large (over 10 gigabytes) but the issue is intermittent with several weeks in between instances of the problem and doesn't occur for other users who have the same procmailrc and gigabyte sized files (although none are as large as this).

The user would prefer not to use MailDir style folders and wants to keep this as a mbox file. Is there a way I can re-write the script to allow mail delivery to the user's mailbox while procmail waits on the lock for bkp? I've tried:

:0c      #copy all mail to "Saved"
{
 :0:
 bkp
}

EDIT: I've altered the above recipes from :0 w: to :0: since w waits on a program and none is being executed in this statement.

Which will allow two emails before it procmail stops accepting email again if I manually lock bkp during tests. If I release the lock before postfix times out, the mail will be delivered. I would also like to determine the root cause of the locking issue, but I haven't been able to trigger it yet except by locking the file myself. I have added LOCKTIMEOUT=10 to try and force the condition without success in normal mail delivery.

Here is the procmail version information:

procmail v3.22 2001/09/10 Copyright (c) 1990-2001, Stephen R. van den Berg Copyright (c) 1997-2001, Philip A. Guenther

Submit questions/answers to the procmail-related mailinglist by sending to:

And of course, subscription and information requests for this list to:

Locking strategies: dotlocking, fcntl() Default rcfile: $HOME/.procmailrc It may be writable by your primary group

share|improve this question
    
Is the file you are locking mounted locally? Procmail is basically NFS-compatible but there are some network outages you simply cannot completely guard against. If you are on NFS, which version? –  tripleee Dec 2 '13 at 7:08
    
The file is on the local filesystem. –  John H Dec 2 '13 at 21:00
    
And you know about the limited support for large files? How large is the file you are writing to, and how large are the other large files which do not exhibit this problem? –  tripleee Dec 3 '13 at 8:24

1 Answer 1

Have you considered using smaller daily/weekly backup mailboxes/files?

You may use cron jobs to move them into main backup.

man procmailex gives examples how to get destination names based on date output.
man procmail gives example how to use formail to postproces mailbox file with locking.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.