[Dovecot] Maildir unreliability

Peter Hessler phessler at theapt.org
Mon Oct 25 03:37:13 EEST 2004

On Mon, 25 Oct 2004 03:02:31 +0300
Timo Sirainen <tss at iki.fi> wrote:

:Looks like maildir can't be used very realiably without quite a lot of 
:locking. Writing and scanning the directory would have to be locked, 
:but reading wouldn't (as long as the file hasn't been renamed which 
:would require scanning to find it). So much for "no locks needed"..
:The problem is that opendir()/readdir() may temporarily not return some 
:files if there has been changes in the directory since the opendir(). 
:That means Dovecot thinks a message is expunged, while in fact it 
:really isn't, and the next scan would usually show it again.
:Currently when that happens, Dovecot usually prints an error message 
:about it and rebuilds indexes. Of course, in real life clients aren't 
:often bombing the same mailbox with tons of changes in multiple 
:connections, which is usually needed to trigger this.
:I wrote a test program which tests this:
:I'd like to hear if you can run it in some system without errors. I 
:tested Linux 2.4 and 2.6 with ext2, ext3, xfs and reiser3, Solaris 
:8/ufs and OpenBSD 3.5/sparc64. Only OpenBSD passed the test, but I'm 
:not sure if it's only because the computer was so slow and didn't 
:switch between processes hard enough. I'd be especially interested 
:about FreeBSD and various NFS systems.
:If it actually works properly in some systems, I guess I'll make the 
:extra locking configurable.

gir.theapt.org:phessler@/usr/home/phessler> ./readdir 
28751: File re-appeared:  -> 983:2,S (2)
4017: File re-appeared:  -> 707:2,S (2)
4017: File re-appeared:  -> 724:2, (2)
4017: File re-appeared:  -> 800:2,S (2)
30179: File re-appeared: 429:2,S -> 429:2, (2)

This is on OpenBSD/macppc -current, the partition is mounted as:
/dev/wd0h on /usr/home type ffs (local, noatime, nodev, nosuid, softdep)

These days the necessities of life cost you about three times what they
used to, and half the time they aren't even fit to drink.

More information about the dovecot mailing list