On 9. Sep 2020, at 11.14, Robert Nowotny <rnowotny1966@gmail.com> wrote:

Sep  3 08:33:25 lxc-imap dovecot: imap(mpaul)<48684><2/9E5mKuAezAqKjk>: Error: Mailbox Sent: UID=2171: read(zlib(/home/vmail/virtualmailboxes/mpaul/storage/m.119)) failed: read(/home/vmail/virtualmailboxes/mpaul/storage/m.119) failed: Broken pipe (FETCH BODY[])

Also this way you can see if the broken mail is actually xz or zstd or zlib. It would be nice to know if there are any zstd or zlib compressed mails that have problems. We did a lot of stress testing with zstd and also with xz, but haven't been able to reproduce any problems. It's also strange that it says taht the error is "Broken pipe" - that doesn't indicate that the mail is corrupted but that there is something more strange going on. So perhaps you don't actually have any mails written as corrupted, but Dovecot is just somehow having trouble reading the mails.

I managed to reproduce this. The files aren't corrupted, it's just that reading is failing. The attached patch should fix the xz code and should make your files readable again.


Yes, it works ! I switched now to "zstd" compression and currently re-compressing all user imap folders (one by one)

Actually, with further testing it looks like the mails were written truncated. My patch simply hides the truncation when reading the mail. But it's anyway best that can be done about them.

zstd also has a bug in writing compressed output, but it should always crash instead of writing broken output.

We'll try to get fixes to these merged to git soon.