#1011238 dsync panic

Package:
dovecot-core
Source:
dovecot
Description:
secure POP3/IMAP server - core files
Submitter:
"Marc F. Clemente"
Date:
2022-05-19 19:33:02 UTC
Severity:
normal
#1011238#5
Date:
2022-05-18 14:56:28 UTC
From:
To:
I am trying to convert my email storage from mbox to maildir.  I have
used this command:

dsync -D -v -u marc mirror mbox:/home/marc/mail:INBOX=/var/mail/marc

It mostly works, and I have been able to convert multiple users.  I get
a lot of debug output about what it's doing, until it crashes like this:

May 18 09:21:20 dsync(marc): Debug: Mailbox Sent: UID 10691: Expunge
requested
May 18 09:21:20 dsync(marc): Debug: Mailbox Sent: UID 10647: Opened mail
because: prefetch
May 18 09:21:20 dsync(marc): Debug: brain S: import mail uid 0 guid
cfb601bf53fe34fbaf6a25475a662866
May 18 09:21:20 dsync(marc): Debug: brain S: Import Sent: Import mail
body for GUID=cfb601bf53fe34fbaf6a25475a662866 UID=0
May 18 09:21:20 dsync(marc): Panic: file mbox-lock.c: line 796
(mbox_lock): assertion failed: (lock_type == F_RDLCK ||
mbox->mbox_lock_type != F_RDLCK)
May 18 09:21:20 dsync(marc): Error: Raw backtrace: #0
test_subprocess_fork[0x7f04b4c778d0] -> #1
backtrace_append[0x7f04b4c77b30] -> #2 backtrace_get[0x7f04b4c77c90] ->
#3 execvp_const[0x7f04b4c84ba0] -> #4
default_fatal_handler[0x7f04b4c84c70] -> #5 i_panic[0x7f04b4bda0a1] ->
#6 [unw_get_proc_name() failed: -10] -> #7
mbox_save_begin[0x7f04b4deefc0] -> #8 mailbox_save_begin[0x7f04b4dbb2c0]
-> #9 mail_storage_copy[0x7f04b4daee30] -> #10
mailbox_save_begin[0x7f04b4dbb410] -> #11 mailbox_copy[0x7f04b4dbb610]
-> #12 dsync_mailbox_import_change[0x55b05aea7f90] -> #13
dsync_mailbox_import_mail[0x55b05aea8480] -> #14
dsync_brain_sync_mails[0x55b05ae9cc90] -> #15
dsync_brain_sync_mails[0x55b05ae9d5f0] -> #16
dsync_brain_run[0x55b05ae9ddb0] -> #17 who_lookup[0x55b05ae82cb0] -> #18
who_lookup[0x55b05ae83cd0] -> #19
doveadm_cmd_ver2_to_mail_cmd_wrapper[0x55b05ae84ea0] -> #20
doveadm_cmd_run_ver2[0x55b05ae8f870] -> #21
doveadm_cmd_try_run_ver2[0x55b05ae8fdb0] -> #22 main[0x55b05ae70ee0] ->
#23 __libc_start_main[0x7f04b4831730] -> #24 _start[0x55b05ae71350]
Abort
Exit 134

If I find the offending message and delete it or move it to another
folder, then I can keep going until it crashes somewhere else.

I notice some mention of lock in the error message.  The filesystem is
ext4.  The only programs accessing the maildir are dovecot and exim4.
Exim is not the problem because the errors happen even when exim is not
running.  In /etc/dovecot/conf.d/10-mail.conf all the lock settings are
commented out.

Any suggestions?  Is there any additional information needed?

Marc

#1011238#10
Date:
2022-05-18 15:38:37 UTC
From:
To:

#1011238#15
Date:
2022-05-19 19:02:33 UTC
From:
To:
Thank you for the advice.  Your link pointed me to more links.
Eventually, I figured out that to migrate from mbox to maildir, I should
have probably used "dsync mirror -1" to do a one-way sync.  It also made
the errors go away.

I am not sure what exactly triggers the error.  Maybe it is duplicate
headers.  Maybe it's duplicate UID's.  Maybe it's something else.
Unfortunately, I doubt that I have the time or the knowledge to
troubleshoot it properly.

Also, "doveadm import" was useful for migrating a few troublesome mbox
files.

Marc