[Dovecot] cannot update mailbox - unable to lock for exclusive access

Ben Morrow ben at morrow.me.uk
Sat Nov 10 22:25:29 EET 2012


At 12PM -0600 on 10/11/12 you (Stan Hoeppner) wrote:
> On 11/8/2012 5:53 PM, Ben Morrow wrote:
> > At  3AM -0600 on  8/11/12 you (Stan Hoeppner) wrote:
> >>
> >> LDA completely eliminates lock contention.
> > 
> > As we have discussed before, using the LDA does not prevent lock
> > contention, it just prevents the problems that arise when different
> > software is using different locking strategies on the same mailbox
> > (assuming nothing except LDA and imap is touching the mailbox directly).
> 
> You seem to have contradicted yourself.  You described lock contention
> to a T, and stated Dovecot does prevents that "problem", but also said
> Dovecot doesn't prevent lock contention.  File locking != lock
> contention.  You can have the former without the latter.

The usual meaning of 'lock contention' is 'two processes legitimately
competing for the *same* lock'. For instance, a search for 'lock
contention' on Wikipedia leads to

    lock contention: This occurs whenever one process or thread attempts
    to acquire a lock held by another process or thread.

This will still occur when using the LDA: that is, there will still be
occasions where the LDA and the imap process are competing for the mbox
lock, and one ends up locking the other out temporarily.

The problems with locking that arise when accessing the same mailbox
using both Dovecot and non-Dovecot software come from different
processes using *different* locks from each other, or acquiring them in
a different order. This is not ordinary lock contention: in fact, in the
worst case, the two processes end up not having any locks in common, so
you get no lock contention at all but data corruption instead.

> > There are valid reasons for not using the LDA: the OP might be already
> > using procmail, for instance, and have users with procmail recipies
> > which sort into IMAP folders. These folders will need to be locked by
> > procmail even if the default delivery to INBOX is changed (globally) to
> > happen through dovecot-lda. While migrating to sieve (and mdbox, and
> > LMTP) would, IMHO, be the best long-term solution, this isn't necessarily
> > something that can be set up overnight.
> 
> And?  I'm failing to understand your point here.

You appear to be advocating the LDA as the solution to all possible
problems with mail delivery, and implying anyone not using it is doing
something seriously wrong. I was pointing out that that is not always
the case.

> The OP hasn't stated
> yet, that I recall, if he's accessing the mbox files with anything other
> than Dovecot and Postfix.  If he does state this, we'll make further
> recommendations as to how get across the LDA bridge with the same
> functionality, or if it's workable.  None of that precludes making the
> LDA recommendation.  Most people already running procmail or local UNIX
> MUAs are savvy enough to discover LDA before hitting this list.  So you
> can assume with some surety that the OP who doesn't know about LDA
> likely isn't using procmail, mutt, pine, etc.  Sure there are
> exceptions, but this is normally the case.

I believe the OP mentioned something about having run out of mboxes for
20 years? To me that suggests an old-fashioned Unix setup, which in turn
suggests procmail as a likely possibility. I could, of course, be wrong.

> I think the problem here, given the tone of your prose above and
> correcting me on the use of "light year" of all damn things, is that my
> earlier praise directed at you due to your slightly greater knowledge of
> the intricacies of file locking, has given you the impression that I'm
> some kind of knuckle dragging noob in need of education by you.  If that
> is the case please read my last 500 posts to this list to dispel that
> misconception.
> 
> You are my peer, not my superior.  Keep that in mind in your future
> correspondence.

If I have offended you, I apologise. That was certainly not my
intention.

Ben




More information about the dovecot mailing list