[Dovecot] locking questions

Timo Sirainen tss at iki.fi
Fri May 11 17:15:58 EEST 2007

On Tue, 2007-04-24 at 13:43 -0400, Stewart Dean wrote:
> I have Dovecot 1.0 in trial use by the IT staff, and have some locking 
> questions
> Background, the mail server runs procmail, sendmail and NFS exports the 
> user homedir and mailbox to a) a login shell host and b) a mailing list 
> services host.  It runs UWIMAP on the usual ports and dovecot on a 
> arbitrary port number.  Because of concern with NFS and file access 
> contention. I have the following dovecot.conf file access parms set:
>    a) mbox_dirty_syncs =  no
>    b) mbox_lazy_writes = no

I'm not sure if these really help anything. UW-IMAP's behavior is the
same as if these were both "yes".

> 1) I am seeing these errmsgs.  Are they anything I should be concerned 
> about, or are they just the inevitable result of lock contention for 
> mailboxes and folders by procmail, imap/dovecot and NFS?
> > In syslog, I am seeing this: 
> >
> > Apr 23 18:46:34 mercury mail:err|error dovecot: IMAP(sdean): stat(/var/spool/mail/sdean.lock) failed: No such file or directory
> > Apr 23 18:46:34 mercury mail:err|error dovecot: IMAP(sdean): file_lock_dotlock() failed with mbox file /var/spool/mail/sdean: No such file or directory

I don't think this is good. I just updated the error message to be


So is this using AIX? Sounds similar to a Solaris NFS problem. Maybe
this helps: http://dovecot.org/list/dovecot/2006-December/018145.html

> 2) I earlier asked, but don't think I got an answer to this question:
> > Everybody wants to lock differently
> > 1) procmail (delivering for sendmail), which seems to want to use 
> > dotlocking, fcntl and lockf locking; for whatever reasons, the compile 
> > time tests seem to disallow flock.
> > 2) UWIMAP which according to wiki.dovecot.org/Migration/UW uses:
> > mbox_read_locks = flock
> > mbox_write_locks = dotlock flock
> > 3) I want to run dovecot in the same environment as I switch over, for 
> > which the locking strategy is supposed to be (according to 
> > http://wiki.dovecot.org/MboxLocking)
> > mbox_read_locks = fcntl
> > mbox_write_locks = dotlock fcntl
> >
> > Since that same page in the wiki says. "*It's important that all 
> > software that's reading or writing to mboxes use the same locking 
> > settings.",* I had recompiled procmail so it only usedotlocking and 
> > fcntl (thus removing lockf in addition to the disallowed flock)...but 
> > now I bumped into the Migration/UW page and there looks to be a conflict.
> >
> > I want to be able to run dovecot (for testing) and UWIMAP (for all 
> > users/production)  at the same time (but never at the same time with 
> > the same mailbox), but UWIMAP is doc'ed to use flock and Dovecot doesn't
> > It's conceivable that the different locking strategies of UWIMAP and 
> > Dovecot don't matter because they would never be going after the same 
> > mail files (right?) but there is procmail, which has to interact with 
> > both.  It appears to not use flock OK, even though the docs say it 
> > should since UWIMAP expects it, and I've disabled lockf as well.  But 
> > will there be a conflict with procmail and dovecot's use of fcntl, 
> > which UWIMAP doesn't use?
> >
> > Help. 

flock works only locally within one computer, so if you're using
multiple that's bad. Just make sure that procmail and Dovecot use
compatible locks, so I guess dotlock and fcntl. If you try to access the
same mailbox using UW-IMAP and Dovecot simultaneously UW-IMAP kills
itself anyway. Also as long as everyone are using dotlock there won't be
any corruption problems.

> 3) I occasionally see "Disconnected for inactivity" message.  How long 
> before that happens?  Is the interval configurable?

It's 30 minutes. It's not configurable, but IMAP RFC says:

"If a server has an inactivity autologout timer, the duration of that
timer MUST be at least 30 minutes."

This is also what all the other servers are using, so the clients should
be smart enough to do at least something within half an hour..

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20070511/1d7ad52f/attachment.pgp 

More information about the dovecot mailing list