core icon indicating copy to clipboard operation
core copied to clipboard

Do not ignore errors when updating quota or resyncing UIDs

Open link2xt opened this issue 5 months ago • 1 comments

This is an attempt to debug #6477. It looks like at least once IMAP loop got stuck after updating quota timed out without logging anything.

First commit adds some logging and makes update_recent_quota bubble up the errors. Next commits turn errors from update_recent_quota and resync_folders into loop failure.

It is dangerous to ignore network errors during IMAP loop because if there is a timeout during reading, it does not mean that the next read will not succeed and return leftover or later received bytes. This is how tokio-io-timeout works and this is consistent with how normal TCP connections and C sockets work - timeout errors does not mean the socket will return the same error on the next call. I still don't know however why this can result into the loop getting stuck, I/O should timeout eventually, so there is likely some parser error involved anyway, but not feeding leftover bytes into it makes it more difficult to trigger at least.

link2xt avatar Jul 16 '25 18:07 link2xt

Another parallel PR to make it less dangerous even if the error is ignored and the stream is not dropped after the first error: https://github.com/chatmail/core/pull/7014

link2xt avatar Jul 18 '25 07:07 link2xt