Re: [Exim] mbx locking

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Ray Miller
CC: exim-users
Subject: Re: [Exim] mbx locking
On Tue, 25 Jan 2000, Ray Miller wrote:

> Previously local deliveries were piped to tmail, which does not have
> the same problems obtaining a lock. Looking at the code, I see that
> tmail uses a blocking flock() call, while exim uses a non-blocking
> fcntl() to lock the mbx lock file.
>
> Having exim block in the fcntl() call (with timeout via SIGALRM) would
> make exim behave more like tmail, and should get around the locking
> problem. Is this easily implemented?


When I started writing Exim I knew nothing about the details of Unix
locking. People told me that flock() was obsolete - it doesn't work over
NFS for a start - so I avoided using it, and used fcntl() for locking.
[This is a bit moot for MBX mailboxes, I know, since they don't work on
NFS files anyway.] What Exim actually does is to try to get the lock a
number of times (set by lock_retries - default 10), waiting for the time
lock_interval (default 3 seconds) between each try. At least this is
what the code is supposed to do. Bugs are always with us...

So if you get a locking error, it has been trying for quite some time.
Would a blocking lock actually help?

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.