Sam Varshavchik <[EMAIL PROTECTED]> wrote:

> It's been brought to my attention that OpenBSD 3.2 can assign the same pid 
> to different processes in the same chronological second (that is, one 
> process terminates, and its pid is immediately assigned to a new process 
> that's created soon thereafter).
> 
> Since filenames for messages in maildirs are generated based on the 
> combination of the pid, and the current time, in seconds, there is now a 
> race condition that will result in loss or corruption of mail.  This breaks 
> Courier and Qmail. Example: process A delivers a message to a maildir just 
> before process B reads Maildir/new, and A's message is moved to Maildir/cur 
> a short time after it's been delivered, and A exits; meanwhile process C 
> starts, and delivers mail to the same maildir; its generated filename will 
> now be the same; so now you will have two messages with the same base 
> filename in the maildir).
> 
> This is not theoretical.  This been brought to my attention after someone
> managed to succesfully deliver two messages with the same filename, on a
> piddly Athlon (as part of a Courier "stress test").  Let's have a round of
> applause for such a noteworthy accomplishment!

Ah, I was testing Courier on a OpenBSD 3.1 machine, and noticed a bit of
odd behavior.  This must be the cause of it!

I had previously run the stress test for mail delivery.  When delivering
a large number of messages at once (like 5000) using that test script, I
would see a few (like 1 to 3) messages somehow dropped.  I never got
any error messages from Courier, and nothing else seemed to be a
problem.  No stuck processes or anything.  At first I thought it was an
NFS problem (all Maildirs were NFS mounted), but setting up an account
for local delivery didn't help.

I've applied the patch to my copy of Courier 0.39.1 on that same OpenBSD
3.1 machine and re-run the perftest1 program.  Now it seems to work
fine, with no dropped messages.

Kudos to Sam and whoever it was that made the connection to recycled
PIDs.

James Graves, CTO
Delta Mobile Software                           http://www.deltamobile.com


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to