<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>I'm trying to migrate dovecot mail database from 2.0.9 on Linux
      to 2.3.20 on FreeBSD. I've rsync'd the entire database, grabbed
      all the configs, changed the paths and permission, but when trying
      to access the mail from Thunderbird I have reproducible crash in
      the logs:</p>
    <p><br>
    </p>
    <pre class="bz_comment_text" id="comment_text_0">===Cut===
Feb 14 17:12:10 it-r-support dovecot[5888]: auth-worker(6378): Debug: mysql(localhost): Finished query 'SELECT maildir, 1143 AS uid, 1143 AS gid FROM mailbox WHERE username = '<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>' AND active = '1'' in 0 msecs
Feb 14 17:12:10 it-r-support dovecot[5888]: auth-worker(6378): Debug: conn unix:auth-worker (uid=143): auth-worker<16>: sql(<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>,192.168.57.177,<oE2zjKn0FTXAqDmx>): Finished userdb lookup
Feb 14 17:12:10 it-r-support dovecot[5888]: auth-worker(6378): Debug: conn unix:auth-worker (uid=143): auth-worker<16>: Finished
Feb 14 17:12:10 it-r-support dovecot[5888]: auth: Debug: sql(<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>,192.168.57.177,<oE2zjKn0FTXAqDmx>): Finished userdb lookup
Feb 14 17:12:10 it-r-support dovecot[5888]: auth: Debug: master userdb out: USER        1282408449      <a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>  maildir=alamics.ru/zheganin-em/ uid=1143        gid=1143        auth_mech=PLAIN auth_token=15cceab95e1251ea97a8e5ff62c70d1b7a76c96f
Feb 14 17:12:10 it-r-support dovecot[5888]: imap-login: Login: user=<<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>>, method=PLAIN, rip=192.168.57.177, lip=172.16.11.13, mpid=6405, session=<oE2zjKn0FTXAqDmx>
Feb 14 17:12:10 it-r-support dovecot[5888]: imap(<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>)<6405><oE2zjKn0FTXAqDmx>: Panic: file array.c: line 10 (array_idx_modifiable_i): assertion failed: (idx < array->buffer->used / array->element_size)
Feb 14 17:12:10 it-r-support dovecot[5888]: imap(<a href="mailto:zheganin-em@alamics.ru" class="moz-txt-link-freetext">zheganin-em@alamics.ru</a>)<6405><oE2zjKn0FTXAqDmx>: Fatal: master: service(imap): child 6405 killed with signal 6 (core dumped)
===Cut===

There's an older thread here mentioning that probably doveadm force-resync would help, but it doesn't fix this. Is there something that could be done here ?
I've also reported this in the FreeBSD bugtracker, but just in case decided to ask here too.

Backtrace:

===Cut===
# lldb /usr/local/libexec/dovecot/imap --core imap-6404.core 
(lldb) target create "/usr/local/libexec/dovecot/imap" --core "imap-6404.core"
Core file '/var/cores/imap-6404.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'imap', stop reason = signal SIGABRT
  * frame #0: 0x000000001151133a libc.so.7`__sys_thr_kill + 10
    frame #1: 0x0000000011489c74 libc.so.7`__raise + 52
    frame #2: 0x000000001153b109 libc.so.7`abort + 73
    frame #3: 0x000000001137a336 libdovecot.so.0`___lldb_unnamed_symbol5855 + 150
    frame #4: 0x0000000011378ad1 libdovecot.so.0`___lldb_unnamed_symbol5844 + 49
    frame #5: 0x0000000011379881 libdovecot.so.0`___lldb_unnamed_symbol5846 + 33
    frame #6: 0x0000000011378ceb libdovecot.so.0`i_panic + 187
    frame #7: 0x000000001136a514 libdovecot.so.0`array_idx_modifiable_i + 100
    frame #8: 0x0000000012054a78 lib20_fts_plugin.so`fts_user_autoindex_exclude + 72
    frame #9: 0x0000000012051b3b lib20_fts_plugin.so`fts_mailbox_allocated + 267
    frame #10: 0x000000001113ad0b libdovecot-storage.so.0`hook_mailbox_allocated + 155
    frame #11: 0x0000000011134491 libdovecot-storage.so.0`mailbox_alloc + 449
    frame #12: 0x0000000001044311 imap`cmd_select_full + 353
    frame #13: 0x000000000104cd92 imap`command_exec + 178
    frame #14: 0x000000000104b64a imap`___lldb_unnamed_symbol1265 + 58
    frame #15: 0x000000000104b7b6 imap`___lldb_unnamed_symbol1265 + 422
    frame #16: 0x000000000104a151 imap`client_handle_input + 465
    frame #17: 0x00000000010488a8 imap`client_input + 120
    frame #18: 0x00000000113936df libdovecot.so.0`io_loop_call_io + 111
    frame #19: 0x0000000011396214 libdovecot.so.0`io_loop_handler_run_internal + 388
    frame #20: 0x0000000011393dea libdovecot.so.0`io_loop_handler_run + 378
    frame #21: 0x0000000011393c28 libdovecot.so.0`io_loop_run + 88
    frame #22: 0x00000000112f6208 libdovecot.so.0`master_service_run + 24
    frame #23: 0x000000000105af67 imap`main + 1383
    frame #24: 0x000000000103c11d imap`_start + 269
(lldb)
===Cut===

Same backtrace in GDB:

===Cut===
<span style="font-family:monospace"><span style="color:#000000;background-color:#ffffff;"># gdb /usr/local/libexec/dovecot/imap --core imap-6404.core  </span>
GNU gdb (GDB) 12.1 [GDB v12.1 for FreeBSD]
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <a class="moz-txt-link-rfc2396E" href="http://gnu.org/licenses/gpl.html"><http://gnu.org/licenses/gpl.html></a>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<a class="moz-txt-link-rfc2396E" href="https://www.gnu.org/software/gdb/bugs/"><https://www.gnu.org/software/gdb/bugs/></a>.
Find the GDB manual and other documentation resources online at:
    <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/documentation/"><http://www.gnu.org/software/gdb/documentation/></a>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/libexec/dovecot/imap...
(No debugging symbols found in /usr/local/libexec/dovecot/imap)
[New LWP 100485]

warning: Could not load shared library symbols for [vdso].
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `dovecot/imap'.
Program terminated with signal SIGABRT, Aborted.
Sent by thr_kill() from pid 6404 and user 1143.
#0  0x000000001151133a in thr_kill () from /lib/libc.so.7
(gdb) bt full
#0  0x000000001151133a in thr_kill () from /lib/libc.so.7
No symbol table info available.
#1  0x0000000011489c74 in raise () from /lib/libc.so.7
No symbol table info available.
#2  0x000000001153b109 in abort () from /lib/libc.so.7
No symbol table info available.
#3  0x000000001137a336 in ?? () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#4  0x0000000011378ad1 in ?? () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#5  0x0000000011379881 in ?? () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#6  0x0000000011378ceb in i_panic () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#7  0x000000001136a514 in array_idx_modifiable_i () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#8  0x0000000012054a78 in fts_user_autoindex_exclude () from /usr/local/lib/dovecot/lib20_fts_plugin.so
No symbol table info available.
#9  0x0000000012051b3b in fts_mailbox_allocated () from /usr/local/lib/dovecot/lib20_fts_plugin.so
No symbol table info available.
#10 0x000000001113ad0b in hook_mailbox_allocated () from /usr/local/lib/dovecot/libdovecot-storage.so.0
No symbol table info available.
#11 0x0000000011134491 in mailbox_alloc () from /usr/local/lib/dovecot/libdovecot-storage.so.0
No symbol table info available.
#12 0x0000000001044311 in cmd_select_full ()
No symbol table info available.
#13 0x000000000104cd92 in command_exec ()
No symbol table info available.
#14 0x000000000104b64a in ?? ()
No symbol table info available.
#15 0x000000000104b7b6 in ?? ()
No symbol table info available.
#16 0x000000000104a151 in client_handle_input ()
No symbol table info available.
#17 0x00000000010488a8 in client_input ()
No symbol table info available.
#18 0x00000000113936df in io_loop_call_io () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#19 0x0000000011396214 in io_loop_handler_run_internal () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#20 0x0000000011393dea in io_loop_handler_run () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#21 0x0000000011393c28 in io_loop_run () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
--Type <RET> for more, q to quit, c to continue without paging-- 
#22 0x00000000112f6208 in master_service_run () from /usr/local/lib/dovecot/libdovecot.so.0
No symbol table info available.
#23 0x000000000105af67 in main ()
No symbol table info available.
(gdb)</span>
===Cut===

Thanks.
Eugene.
<span style="font-family:monospace"><span style="color:#000000;background-color:#ffffff;"></span></span></pre>
  </body>
</html>