Skip to content

Commit

Permalink
imapc: Fix potential assert-crash when reconnecting during syncing
Browse files Browse the repository at this point in the history
Fixes:
Panic: file imapc-sync.c: line 328 (imapc_initial_sync_check): assertion failed: (mail_index_is_expunged(view, lseq) || seq_range_exists(&ctx->mbox->delayed_expunged_uids, luid))
  • Loading branch information
sirainen committed Jun 18, 2018
1 parent 800ed1e commit 4273c57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib-storage/index/imapc/imapc-storage.c
Expand Up @@ -628,6 +628,7 @@ static void imapc_mailbox_reopen(void *context)
mbox->sync_next_rseq = 1;
}

mbox->state_fetched_success = FALSE;
mbox->initial_sync_done = FALSE;
mbox->selecting = TRUE;
mbox->selected = FALSE;
Expand Down
6 changes: 6 additions & 0 deletions src/lib-storage/index/imapc/imapc-sync.c
Expand Up @@ -411,6 +411,12 @@ static void imapc_sync_index(struct imapc_sync_context *ctx)
imapc_mailbox_run(mbox);
array_free(&ctx->expunged_uids);

if (!mbox->state_fetched_success) {
/* All the sync commands succeeded, but we got disconnected.
imapc_initial_sync_check() will crash if we go there. */
ctx->failed = TRUE;
}

/* add uidnext & highestmodseq after all appends */
imapc_sync_uid_next(ctx);
imapc_sync_highestmodseq(ctx);
Expand Down

0 comments on commit 4273c57

Please sign in to comment.