Comment 0 for bug 1992848

Revision history for this message
Andre Nathan (andre-digirati) wrote : Backport virtual storage panic from 2.3.18

Hello

We're being hit by the following error using Jammy's version of Dovecot:

Oct 13 19:21:32 imap1 dovecot: lmtp(2572154): Panic: file mail-user.c: line 229 (mail_user_deinit): assertion failed: ((*user)->refcount == 1)

This error has been reported as fixed upstream in version 2.3.18, according to https://dovecot.org/doc/NEWS:

- virtual: If mailbox opening fails, the backend mailbox is leaked and
  process crashes when client disconnects. Fixes
  Panic: file mail-user.c: line 232 (mail_user_deinit):
  assertion failed: ((*user)->refcount == 1)

The correction is simple:

--- a/src/plugins/virtual/virtual-storage.c
+++ b/src/plugins/virtual/virtual-storage.c
@@ -495,12 +495,12 @@ static int virtual_mailbox_open(struct mailbox *box)
                ret = virtual_mailboxes_open(mbox, box->flags);
                array_pop_back(&mbox->storage->open_stack);
        }
+ if (ret == 0)
+ ret = index_storage_mailbox_open(box, FALSE);
        if (ret < 0) {
                virtual_mailbox_close_internal(mbox);
                return -1;
        }
- if (index_storage_mailbox_open(box, FALSE) < 0)
- return -1;

        mbox->virtual_ext_id =
                mail_index_ext_register(mbox->box.index, "virtual", 0,

Do you think a patch could be added to the Jammy package with that fix?

Ubuntu release: Ubuntu 22.04.1 LTS
Dovecot version: 1:2.3.16+dfsg1-3ubuntu2.1

Thanks,
Andre