On Tue, 2012-05-15 at 12:23 +0200, Wouter de Geus wrote:
Hello folks,
This morning I tried to open an old archive mail folder using Mutt. However, while fetching headers it aborted. Checking the dovecot log gave me this:
@400000004fb21996267d37d4 imap(benv): Error: Cached message size smaller than expected (9115 < 9420) @400000004fb21996267e8bac imap(benv): Error: Maildir filename has wrong S value, renamed the file from /home/vpopmail/domains/benv.junerules.com/benv/Maildir/.Old.2009/cur/1260395566.28175.black,S=9115:2,S to /home/vpopmail/domains/benv.junerules.com/benv/Maildir/.Old.2009/cur/1260395566.28175.black,S=9420:2,S @400000004fb21996267e937c imap(benv): Error: Corrupted index cache file /home/vpopmail/domains/benv.junerules.com/benv/Maildir/.Old.2009/dovecot.index.cache: Broken physical size for mail UID 294 @400000004fb21996267eaaec imap(benv): Error: read(/home/vpopmail/domains/benv.junerules.com/benv/Maildir/.Old.2009/cur/1260395566.28175.black,S=9115:2,S) failed: Input/output error (uid=294) @400000004fb219962680683c imap(benv): Info: Disconnected: Internal error occurred. Refer to server log for more information. [2012-05-15 10:53:32] in=6503 out=192718
I've retried opening this folder several times, but each time Dovecot only fixes 1 file and then aborts. (the folder apparently has a lot more files with incorrect sizes). My question here is: Why does dovecot abort? Isn't the issue fixed after the rename?
That file was fixed, but you probably have tons of them and it aborts after each one. With IMAP protocol there's really no other good way to do this. I guess if it notices one file being wrong it could just decide to go into error recovery check and read through all of the maildir files, but that's annoying extra piece of code for something that shouldn't happen anyway..
You should be able to manually fix them by reading them via doveadm, something like:
doveadm fetch -u benv text all > /dev/null
Also: The files are not corrupted or unreadable, reading them through the commandline works fine. I've looked through my backups and saw that at least half a year ago this mismatch in size was already present.
I've been running dovecot for quite a while, so the cause of this size mismatch might very well be a issue in an older version of dovecot / my configuration. Right now I'm running dovecot 2.1.6, but I've been running the v1.2 version for quite a while before that.
Old Dovecot versions didn't notice the problem. You can make v2.1 also just ignore the wrong sizes with maildir_broken_filename_sizes=yes.