[Dovecot] flock problems with index files and passwd-file

Michal Soltys nozo at ziu.info
Thu Mar 15 13:18:04 EET 2007


While experimenting a bit, I found that for some reason, locking indexes 
with flock is problematic, but only if user is taken from passwd-file. 
The host system is openbsd 3.9, dovecot's configuration is added at the 
bottom.

Authentication is from two places - first from mentioned passwd-file, 
then from passwd file using bsdauth (in this case, there're no problems 
with flock). So, if a user is i.e.:

test at domain.tld:{plain}test:20000:10::/home/regular/test::userdb_mail=maildir:~/Maildir

Then the mail client will timeout (thunderbird in this case), and 
dovecot will leave following info in the logs:

Mar 15 11:13:38 rasengan dovecot: IMAP(test at domain.tld): Effective 
uid=20000, gid=10, home=/home/regular/test
Mar 15 11:13:38 rasengan dovecot: IMAP(test at domain.tld): maildir: 
data=~/Maildir
Mar 15 11:13:38 rasengan dovecot: IMAP(test at domain.tld): maildir: 
root=~/Maildir, index=~/Maildir, control=, inbox=
Mar 15 11:15:38 rasengan dovecot: IMAP(test at domain.tld): Timeout while 
waiting for lock for transaction log file 
/home/regular/test/Maildir/dovecot.index.log

Happens both if in maildir and mbox 
(userdb_mail=mbox:~/mail:INBOX=/home/regular/test/mbx) cases.

Locking through dotlocks or fcntl works well in all situations 
(passwd-file or not).

Dovecot 1.0 rc27
OpenBSD 3.9 (stable), i386

Dovecot config (dovecot -n):

# /etc/dovecot.conf
base_dir: /var/dovecot/
protocols: imap imaps pop3 pop3s
ssl_listen: *
ssl_ca_file: /etc/ssl/cert_bundle.pem
ssl_cert_file: /etc/ssl/ca_ppgk/certs/fetch_crt.pem
ssl_key_file: /etc/ssl/ca_ppgk/private/fetch_key.pem
verbose_ssl: yes
login_dir: /var/dovecot/login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
login_greeting: Dovecot IMAP server ready.
login_greeting_capability(default): yes
login_greeting_capability(imap): yes
login_greeting_capability(pop3): no
valid_chroot_dirs: /var/mail:/home/regular
verbose_proctitle: yes
first_valid_uid: 1999
first_valid_gid: 10
mail_location: mbox:~/Mail:INBOX=/var/mail/%u
mail_debug: yes
lock_method: flock
maildir_copy_with_hardlinks: yes
mbox_read_locks: flock
mbox_write_locks: flock
mail_executable(default): /usr/local/libexec/dovecot/imap
mail_executable(imap): /usr/local/libexec/dovecot/imap
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
imap_client_workarounds(default): outlook-idle delay-newmail
imap_client_workarounds(imap): outlook-idle delay-newmail
imap_client_workarounds(pop3): outlook-idle
pop3_uidl_format(default):
pop3_uidl_format(imap):
pop3_uidl_format(pop3): %08Xu%08Xv
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
   verbose: yes
   debug: yes
   passdb:
     driver: passwd-file
     args: /etc/dovecot.passwd
   passdb:
     driver: bsdauth
   userdb:
     driver: passwd-file
     args: /etc/dovecot.passwd
   userdb:
     driver: passwd

/etc/dovecot.passwd is just a single line:

test at domain.tld:{plain}test:20000:10::/home/regular/test::userdb_mail=maildir:~/Maildir



More information about the dovecot mailing list