failed: Cached message size smaller than expected

Michael Grant mgrant at grant.org
Fri Apr 2 23:45:33 EEST 2021


Every few days, my mailbox seizes up.  No mail come in to my imap clients.

I'm getting these errors over and over with my mailbox:

  Error: Mailbox INBOX: Deleting corrupted cache record uid=371208: UID 371208: Broken physical size in mailbox INBOX: read(/var/mail/mgrant) failed: Cached message size smaller than expected (17212 < 17222, box=INBOX, UID=371208)
  Error: Mailbox INBOX: UID=371208: read(/var/mail/mgrant) failed: Cached message size smaller than expected (17212 < 17222, box=INBOX, UID=371208) (FETCH BODY[])
  Error: Mailbox INBOX: Deleting corrupted cache record uid=371203: UID 371203: Broken physical size in mailbox INBOX: read(/var/mail/mgrant) failed: Cached message size smaller than expected (3904 < 3914, box=INBOX, UID=371203)
  Error: Mailbox INBOX: UID=371203: read(/var/mail/mgrant) failed: Cached message size smaller than expected (3904 < 3914, box=INBOX, UID=371203) (FETCH BODY[])

My inbox is an mbox file.  I'm running dovecot installed on Debian
Bullseye, the dovecot packages are all: 1:2.3.13+dfsg1-1

I am running sendmail and using procmail for local delivery.

I suspect, but am not certain, that this may be some locking issue
between procmail and dovecot but I have never been able to prove
that. The final procmail rule which appends messages to my mailbox
looks like this, the trailing ':' causes procmail to use a lockfile:

:0:
/var/mail/mgrant

The locking config lines in 10-mail.conf are commented, but I have
also tried uncommenting them, did not help:

#mbox_read_locks = fcntl
#mbox_write_locks = fcntl dotlock

Though sometimes it seems to fix itself after a few hours, the only
way I have found to fix this quickly is to manually remove the cache
files and restart dovecot:

rm ~/mail/.imap/INBOX/*
systemctl restart dovecot

I am not even sure this is a locking issue.  Something definitely gets
corrupted though. I do have several IMAP clients hitting the same
mailbox (phone, laptop, desktop).  On the phone, I run K9 and also the
gmail client which talks imap.  Also using thunderbird, outlook, and
w10 mail, though typically not all at the same time.  You could
definitely say I am stress testing this setup a bit!

Any ideas on how to resolve this?

Michael Grant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://dovecot.org/pipermail/dovecot/attachments/20210402/5bb1d84b/attachment.sig>


More information about the dovecot mailing list