<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On 10. Sep 2020, at 14.07, Robert Nowotny <<a href="mailto:rnowotny1966@gmail.com" class="">rnowotny1966@gmail.com</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""> On 9. Sep 2020, at 11.14, Robert Nowotny <<a href="mailto:rnowotny1966@gmail.com" class="gmail-">rnowotny1966@gmail.com</a>> wrote:<br class="gmail-"><div class=""><blockquote type="cite" class="gmail-"><br class="gmail-Apple-interchange-newline"><div class="gmail-"><div class="gmail-"><div dir="ltr" class="gmail-"><div class="gmail-"><blockquote type="cite" class="gmail-" style="font-family:Helvetica;font-size:12px"><div class="gmail-" style="overflow-wrap: break-word;"><div class="gmail-"><blockquote type="cite" class="gmail-"><div class="gmail-"><div dir="ltr" class="gmail-"><div class="gmail-moz-text-html" lang="x-unicode"><div class="gmail-moz-forward-container"><font class="gmail-" face="Courier New">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[])<br class="gmail-"></font></div></div></div></div></blockquote><div class="gmail-"><br class="gmail-"></div><div class="gmail-">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.</div></div></div></blockquote><br class="gmail-" style="font-family:Helvetica;font-size:12px"></div><div class="gmail-">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.</div><div class="gmail-"><br class="gmail-"></div><div class="gmail-"><br class="gmail-"></div><div class="gmail-">Yes, it works ! I switched now to "zstd" compression and currently re-compressing all user imap folders (one by one)</div></div></div></div></blockquote><br class="gmail-"></div><div class="">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.</div><div class=""><br class="gmail-"></div><div class="">zstd also has a bug in writing compressed output, but it should always crash instead of writing broken output.</div><div class=""><br class="gmail-"></div><div class="">We'll try to get fixes to these merged to git soon.</div><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">currently I am re-compressing the mailboxes and so far i can see only one (1) Error, after about 120GB of recomresses emails :<br class=""></div><div class=""><br class=""></div><div class="">Sep 10 11:32:24 lxc-imap dovecot: imap(ebay)<37070><1aDvPvKus+/AqKjk>: Panic: file ostream.c: line 287 (o_stream_sendv_int): assertion failed: (!stream->blocking)<br class=""></div></div></div></blockquote><div><br class=""></div><div>This is fixed now.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">until now I only have one broken mailbox, I need to repair (I will try that later, just finish all the other users before): <br class=""></div><div class=""><br class=""></div><div class=""><div class="">Sep 10 12:13:13 lxc-imap dovecot: imap(mtrenner)<41872><KVTf0PKu7+7AqKi0>: Error: lzma.read(/home/vmail/virtualmailboxes/mtrenner/storage/m.349): corrupted data at 3763912<br class="">Sep 10 12:13:13 lxc-imap dovecot: imap(mtrenner)<41872><KVTf0PKu7+7AqKi0>: Error: Mailbox Sent: UID=1480: read(zlib(/home/vmail/virtualmailboxes/mtrenner/storage/m.349)) failed: read(/home/vmail/virtualmailboxes/mtrenner/storage/m.349) failed: lzma.read(/home/vmail/virtualmailboxes/mtrenner/storage/m.349): corrupted data at 3763912 (FETCH BODY[])<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>For this you can use the method I mentioned in earlier mail (doveadm fetch+expunge+save).</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""></div></div><div class=""><div class=""><div class="">> zstd also has a bug in writing compressed output, but it should always crash instead of writing broken output.</div><div class="">> We'll try to get fixes to these merged to git soon.<br class=""></div><div class=""><br class=""></div></div><div class="">Uh-Oh, that would be good ... pls notify !</div><div class="">how such thing can slip through the tests ?</div><div class="">I just can not remember, the last error with compression was like 10 years ago (dont know if it was me who reported that)</div></div></div></div></blockquote><br class=""></div><div>We had a bunch of tests, but this required a large input buffer to be feeded to the zstd compression code, which didn't happen all that easily. I only accidentally caught it with the same test as I wrote for reproducing the xz bug.</div><div><br class=""></div><div>Here's the list of fixes related to both xz and zstd:</div><div><br class=""></div><div><a href="https://github.com/dovecot/core/commit/48083d9e7fdbe257b0be33043ecf0ca87489eef9" class="">https://github.com/dovecot/core/commit/48083d9e7fdbe257b0be33043ecf0ca87489eef9</a></div><div><a href="https://github.com/dovecot/core/commit/a96e742047635ecb8df67c9dbb36b05e0b8fa8e6" class="">https://github.com/dovecot/core/commit/a96e742047635ecb8df67c9dbb36b05e0b8fa8e6</a></div><div><a href="https://github.com/dovecot/core/commit/a775fe3d066f1a2e12d0093fa52527270ad8a0f6" class="">https://github.com/dovecot/core/commit/a775fe3d066f1a2e12d0093fa52527270ad8a0f6</a></div><div><a href="https://github.com/dovecot/core/commit/d559f587677377a34c1f32d321719aa4838cf7a8" class="">https://github.com/dovecot/core/commit/d559f587677377a34c1f32d321719aa4838cf7a8</a></div><div><a href="https://github.com/dovecot/core/commit/3d0f6cf3e04da0d85bbb853fbf4c6dff1d08af50" class="">https://github.com/dovecot/core/commit/3d0f6cf3e04da0d85bbb853fbf4c6dff1d08af50</a></div><div><br class=""></div><div>Note that if you apply these patches, they'll now correctly detect the truncated xz emails and will cause dsync to fail when reading them. So you might want to use the previous patch to finish the dsync migration.</div><div><br class=""></div></body></html>