> On 12/12/2024 17:00 EET Ewald Dieterich via dovecot <dovecot@dovecot.org> 
> wrote:
> 
>  
> I'm running Dovecot 2.3.21 with the mdbox mailbox format. I lose mails 
> (with an asterisk, see below) when I'm doing the following in 2 IMAP 
> sessions:
> 
> Session 1: Create a folder, save a mail and select it:
> 
> . create folder
> . append folder {1}
> . select folder
> * 1 EXISTS
> * OK [UIDVALIDITY 1734013510] UIDs valid
> 
> Session 2: Delete the folder, create it again, save a mail in it, check 
> the number of messages and the uidvalidity:.
> 
> . delete folder
> . create folder
> . append folder {1}
> . status folder (messages uidvalidity)
> * STATUS folder (MESSAGES 1 UIDVALIDITY 1734013511)
> 
> Everything is as expected until here, the uidvalidity was increased by 
> 1, which makes sense.
> 
> Session 1: Just do a noop
> 
> . noop
> * BYE IMAP session state is inconsistent, please relogin.
> 
> Dovecot notices that something is wrong and closes the connection. This 
> error is logged:
> 
> Error: Mailbox folder: Corrupted transaction log file 
> /var/spool/dovecot/user/mailboxes/folder/dbox-Mails/dovecot.index.log 
> seq 2: indexid changed: 1734011270 -> 1734011403 (sync_offset=0)
> 
> Session 2: Check the folder again:
> 
> . status folder (messages uidvalidity)
> * STATUS folder (MESSAGES 0 UIDVALIDITY 1734013512)
> 
> The mail is gone, uidvalidity was again increased by 1, so this is a new 
> folder.
> 
> I think the problem is that the folder's transaction log is deleted in 
> session 1 in mail_transaction_log_file_open() when Dovecot notices 
> discrepancies in what it expects:
> 
> if (ret == 0) {
>          /* corrupted */
>          if (index->readonly) {
>                  /* don't delete */
>          } else {
>                  i_unlink_if_exists(file->filepath);
>          }
>          *reason_r = "File is corrupted";
>          return 0;
> }
> 
> This basically recreates the folder, so now it's empty.
> 
> Here's the asterisk: I know that technically the mail isn't lost because 
> it's still in the storage file and can be recovered. But it's still 
> ugly. And when I copy a mail from another folder instead of appending 
> it, I can't recover it for the folder because the information that the 
> mail was copied is definitely lost.
> 
> Can this be fixed in Dovecot?

Hi!

Thank you for your bug report, we'll take a look. Does the folder recover if 
you run doveadm force-resync?

Aki
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to