Skip to content

Commit

Permalink
imapc: Fix assert-crash when reconnecting expunges newly added messages
Browse files Browse the repository at this point in the history
The initial FETCH 1:* during reconnection may notice some messages that are
missing and tries to expunge them. But those messages could still be in
delayed_sync_trans, and currently lib-index doesn't support expunging anything
but the latest mail from a transaction.

Fixes:
Panic: file mail-index-transaction-update.c: line 337 (mail_index_expunge_last_append): assertion failed: (seq == t->last_new_seq)
  • Loading branch information
sirainen committed Jun 26, 2018
1 parent 7c58144 commit 7a52620
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -199,7 +199,7 @@ imapc_mailbox_fetch_state_finish(struct imapc_mailbox *mbox)
that our IMAP connection hasn't seen yet */
break;
}
mail_index_expunge(mbox->delayed_sync_trans, lseq);
imapc_mailbox_index_expunge(mbox, uid);
}

mbox->sync_next_lseq = 0;
Expand Down Expand Up @@ -560,8 +560,9 @@ static void imapc_untagged_fetch(const struct imapc_untagged_reply *reply,
/* we're doing the initial full sync of mails. expunge any
mails that no longer exist. */
while (mbox->sync_next_lseq < lseq) {
mail_index_expunge(mbox->delayed_sync_trans,
mbox->sync_next_lseq);
mail_index_lookup_uid(mbox->delayed_sync_view,
mbox->sync_next_lseq, &uid);
imapc_mailbox_index_expunge(mbox, uid);
mbox->sync_next_lseq++;
}
i_assert(lseq == mbox->sync_next_lseq);
Expand Down

0 comments on commit 7a52620

Please sign in to comment.