[Dovecot] Locking /var/mail/user issue with postfix and dovecot

Stan Hoeppner stan at hardwarefreak.com
Thu Oct 25 21:00:24 EEST 2012


On 10/25/2012 2:23 AM, Robert JR wrote:
> On 2012-10-25 06:57, Stan Hoeppner wrote:
> 
>> On 10/24/2012 3:04 PM, Robert JR wrote:
>>
>>> I have a question regarding mailbox locking and hope any one can help
>>> me to better understanding the locking of mbox My Postfix lock option
>>> is fcntl dotlock mailbox_delivery_lock = fcntl, dotlock
>>> virtual_mailbox_lock = fcntl, dotlock My Dovecot lock option is fcntl
>>> only mbox_write_locks = fcntl mbox_read_locks = fcntl
>>
>> <snip>
>>
>> Postfix is delivering the mail to dovecot. This is done via the deliver
>> program or lmtp which are pipes, not files. Thus, why is Postfix
>> attempting to write files in the user's mail directory?
>>
>> You write new mail to the mailbox file with either Dovecot or Postfix,
>> not both. Fix that problem and the locking problem disappears.
> 
> Stan, sorry but you didnot understand my question at all

Yes, actually I did, but I missed one part of it because I assumed you
had Dovecot setup properly.

It doesn't matter if the mbox locks are write or read or both.  Locks
are the problem, period, because you have two daemons fighting over the
same files.  The fix is absolutely trivial:

Switch Postfix to use the Dovecot Local Deliver Agent (LDA) in place of
the Postfix local/virtual delivery agent.  Using Dovecot LDA eliminates
the file locking issue.  Thus it also increases throughput as lock
latency is eliminated.  It also enables using all the Dovecot delivery
plugins such as Sieve, Quota, anti-spam, etc.

I had the same Postfix/Dovecot mbox locking problem many years ago when
I first started using Dovecot.  After the suggestions from the fine
folks on this list I switched to LDA.  It not only eliminated locking,
it completely changed the character of my Dovecot install, both in
performance and capabilities, as well as fixed some message flag
problems, etc.  If you're not using LDA with Postfix/Dovecot you're
insane. ;)  Some might say you're insane for using mbox but I feel it's
fine for many installations.  I use it myself.  Our setups are very
similar.  To switch to LDA...

If you're using 1.2.x
http://wiki.dovecot.org/LDA/Postfix

If you're using 2.x
http://wiki2.dovecot.org/LDA/Postfix

-- 
Stan




More information about the dovecot mailing list