<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Ellie,</p>
    <p>Thanks for helping me look at this.<br>
    </p>
    <div class="moz-cite-prefix">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style>
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}</style>On 2019-10-09 16:17, ellie timoney
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:90b6d2f0-924d-4530-93fd-3eeaf95b0e18@www.fastmail.com">
      <pre class="moz-quote-pre" wrap="">Does the same problem occur if you use sync_client (on the master server, as the cyrus user) to replicate the shared mailbox to the backup server (rather than using XBACKUP over IMAP)?  Something like "sync_client -n rsync  -m <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a>" I think? 
</pre>
    </blockquote>
    <p>With -m I get this familiar output on the master:</p>
    <p># /usr/lib/cyrus/bin/sync_client -v -n rsync -m
      <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      MAILBOXES polyfoam.com.au!support<br>
      Error from sync_do_mailboxes(): bailing out!</p>
    <p>and this is seen in the log on the backup server:</p>
    <p>Oct 11 17:39:58 rsync cyrus/backupd[3969]: login:
      mail-3175-1.polyfoam.com.au [10.3.244.125] rsync-mail-3175-1
      DIGEST-MD5 User logged in<br>
      Oct 11 17:39:58 rsync cyrus/backupd[3969]: created decompress
      buffer of 4102 bytes<br>
      Oct 11 17:39:58 rsync cyrus/backupd[3969]: created compress buffer
      of 4073 bytes<br>
      Oct 11 17:39:58 rsync cyrus/backupd[3969]: decompressed 47 ->
      41 bytes<br>
      Oct 11 17:39:58 rsync cyrus/master[458]: process type:SERVICE
      name:backupd path:/usr/lib/cyrus/bin/backupd age:201.603s pid:3969
      signaled to death by signal 11 (Segmentation fault, core dumped)<br>
      Oct 11 17:39:58 rsync cyrus/master[458]: service backupd/ipv4 pid
      3969 in BUSY state: terminated abnormally<br>
      Oct 11 17:39:58 rsync cyrus/master[458]: service backupd/ipv4 now
      has 0 ready workers</p>
    <p>There, a core dump.  Here is what I get from a backtrace:</p>
    <p># coredumpctl gdb -1 <br>
                 PID: 3969 (backupd)<br>
                 UID: 103 (cyrus)<br>
                 GID: 8 (mail)<br>
              Signal: 11 (SEGV)<br>
           Timestamp: Fri 2019-10-11 17:39:58 AEDT (2min 16s ago)<br>
        Command Line: /usr/lib/cyrus/bin/backupd<br>
          Executable: /usr/lib/cyrus/bin/backupd<br>
       Control Group: /system.slice/cyrus-imapd.service<br>
                Unit: cyrus-imapd.service<br>
               Slice: system.slice<br>
             Boot ID: c887b7eb1d734962b8bddb745df21e8f<br>
          Machine ID: facebc4e2dcd47a68a097acc9077814e<br>
            Hostname: rsync<br>
             Storage:
/var/lib/systemd/coredump/core.backupd.103.c887b7eb1d734962b8bddb745df21e8f.3969.1570775998000000.lz4<br>
             Message: Process 3969 (backupd) of user 103 dumped core.<br>
                      <br>
                      Stack trace of thread 3969:<br>
                      #0  0x00007f95c17e3206 __GI___strlen_sse2
      (libc.so.6)<br>
                      #1  0x00007f95c2080119 xstrdup (libcyrus_min.so.0)<br>
                      #2  0x00005557e89fe440 is_mailboxes_single_user
      (backupd)<br>
                      #3  0x00005557e89eec88 main (backupd)<br>
                      #4  0x00007f95c176f09b __libc_start_main
      (libc.so.6)<br>
                      #5  0x00005557e89ef34a _start (backupd)<br>
      <br>
      GNU gdb (Debian 8.2.1-2+b1) 8.2.1<br>
      Copyright (C) 2018 Free Software Foundation, Inc.<br>
      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><br>
      This is free software: you are free to change and redistribute it.<br>
      There is NO WARRANTY, to the extent permitted by law.<br>
      Type "show copying" and "show warranty" for details.<br>
      This GDB was configured as "x86_64-linux-gnu".<br>
      Type "show configuration" for configuration details.<br>
      For bug reporting instructions, please see:<br>
      <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/bugs/"><http://www.gnu.org/software/gdb/bugs/></a>.<br>
      Find the GDB manual and other documentation resources online at:<br>
          <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/documentation/"><http://www.gnu.org/software/gdb/documentation/></a>.<br>
      <br>
      For help, type "help".<br>
      Type "apropos word" to search for commands related to "word"...<br>
      Reading symbols from /usr/lib/cyrus/bin/backupd...Reading symbols
      from
/usr/lib/debug/.build-id/e3/b2619440ce57c6ae7db282266976a826059cf2.debug...done.<br>
      done.<br>
      [New LWP 3969]<br>
      [Thread debugging using libthread_db enabled]<br>
      Using host libthread_db library
      "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
      Core was generated by `/usr/lib/cyrus/bin/backupd'.<br>
      Program terminated with signal SIGSEGV, Segmentation fault.<br>
      #0  __strlen_sse2 () at
      ../sysdeps/x86_64/multiarch/../strlen.S:120<br>
      120    ../sysdeps/x86_64/multiarch/../strlen.S: No such file or
      directory.<br>
      (gdb) bt<br>
      #0  __strlen_sse2 () at
      ../sysdeps/x86_64/multiarch/../strlen.S:120<br>
      #1  0x00007f95c2080119 in xstrdup (str=0x0) at lib/xmalloc.c:95<br>
      #2  0x00005557e89fe440 in is_mailboxes_single_user
      (dl=0x5557e9472900) at backup/backupd.c:1438<br>
      #3  cmd_get (dl=0x5557e9472900) at backup/backupd.c:1489<br>
      #4  cmdloop () at backup/backupd.c:688<br>
      #5  service_main (argc=<optimized out>, argv=<optimized
      out>, envp=<optimized out>) at backup/backupd.c:282<br>
      #6  0x00005557e89eec88 in main (argc=<optimized out>,
      argv=<optimized out>, envp=0x7ffc01307b38)<br>
          at master/service.c:638<br>
      (gdb) up<br>
      #1  0x00007f95c2080119 in xstrdup (str=0x0) at lib/xmalloc.c:95<br>
      95    lib/xmalloc.c: No such file or directory.<br>
      (gdb) up<br>
      #2  0x00005557e89fe440 in is_mailboxes_single_user
      (dl=0x5557e9472900) at backup/backupd.c:1438<br>
      1438    backup/backupd.c: No such file or directory.<br>
      (gdb) p *dl<br>
      $2 = {name = 0x5557e9415590 "MAILBOXES", head = 0x5557e947c0b0,
      tail = 0x5557e947c0b0, next = 0x0, type = 10, <br>
        sval = 0x0, nval = 0, gval = 0x0, part = 0x0}<br>
      (gdb) </p>
    <pre class="moz-quote-pre" wrap="">> What about if you use "sync_client -n rsync -u <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a>" instead (i.e. with -u treating the shared mailbox as a USER rather than as a -m MAILBOX)?

This doesn't crash, but it instead transfers a since-deleted full user <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> (from earlier dross in my database before I made <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> a public mailbox) to the backup server:
</pre>
    <p># /usr/lib/cyrus/bin/sync_client -v -v -n rsync -u
      <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      cyrus/sync_client[201108]: couldn't authenticate to backend
      server: no mechanism available<br>
      >1570776887>COMPRESS DEFLATE<br>
      <1570776887<OK DEFLATE active<br>
      USER <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      >1570776887>GET USER <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      <1570776887<* MAILBOX %(UNIQUEID jkt2bnhgvdgxbotfkmo7jz9j
      MBOXNAME polyfoam.com.au!user.support MBOXTYPE NIL LAST_UID 3
      HIGHESTMODSEQ 11 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE
      1570530398 POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY
      1570528039 PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   debbiep@polyfoam.com.au   lrswipkxtecda   ">"support@polyfoam.com.au   
      lrswipkxtecdan    debbiep@polyfoam.com.au    lrswipkxtecda    "</a>
      OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0 QUOTAROOT NIL XCONVMODSEQ 0
      ANNOTATIONS (%(ENTRY /comment USERID "" VALUE "Support (Polyfoam
      group)") %(ENTRY /comment USERID admdebbiep VALUE Support)))<br>
      * MAILBOX %(UNIQUEID 33oidc614u2i31hqutvkywu8 MBOXNAME
      polyfoam.com.au!user.support.Archive MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 1 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0 ANNOTATIONS (%(ENTRY /specialuse
      USERID <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> VALUE {8+}<br>
      \archive)))<br>
      * MAILBOX %(UNIQUEID 5wwsybv1ftur0vwaeeuvb0pk MBOXNAME
      polyfoam.com.au!user.support.Drafts MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 2 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0 ANNOTATIONS (%(ENTRY /specialuse
      USERID <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> VALUE {5+}<br>
      \sent)))<br>
      * MAILBOX %(UNIQUEID 7k6a536yhh9zc3t3j5f9z93u MBOXNAME
      polyfoam.com.au!user.support.Important MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 1 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0 ANNOTATIONS (%(ENTRY /specialuse
      USERID <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> VALUE {10+}<br>
      \important)))<br>
      * MAILBOX %(UNIQUEID zdl5xlyfx1wtcpp9gd3ce50l MBOXNAME
      polyfoam.com.au!user.support.Junk MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 1 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0 ANNOTATIONS (%(ENTRY /specialuse
      USERID <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> VALUE {5+}<br>
      \junk)))<br>
      * MAILBOX %(UNIQUEID pi3ppdusz8pgio8lyrkj7tiw MBOXNAME
      polyfoam.com.au!user.support.Sent MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 1 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0)<br>
      * MAILBOX %(UNIQUEID a888coldtyz7dwop51uuqbot MBOXNAME
      polyfoam.com.au!user.support.Trash MBOXTYPE NIL LAST_UID 0
      HIGHESTMODSEQ 1 RECENTUID 0 RECENTTIME 0 LAST_APPENDDATE 0
      POP3_LAST_LOGIN 0 POP3_SHOW_AFTER 0 UIDVALIDITY 1570528039
      PARTITION default ACL <a class="moz-txt-link-rfc2396E" href="mailto:support@polyfoam.com.au   lrswipkxtecdan   ">"support@polyfoam.com.au   
      lrswipkxtecdan    "</a> OPTIONS P SYNC_CRC 0 SYNC_CRC_ANNOT 0
      QUOTAROOT NIL XCONVMODSEQ 0 ANNOTATIONS (%(ENTRY /specialuse
      USERID <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a> VALUE {6+}<br>
      \trash)))<br>
      * LSUB (polyfoam.com.au!user.support
      polyfoam.com.au!user.support.Archive
      polyfoam.com.au!user.support.Drafts
      polyfoam.com.au!user.support.Junk
      polyfoam.com.au!user.support.Sent
      polyfoam.com.au!user.support.Trash)<br>
      OK Success<br>
      cyrus/sync_client[201108]: Inbox missing on master for
      <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      UNUSER <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      >1570776887>APPLY UNUSER <a class="moz-txt-link-abbreviated" href="mailto:support@polyfoam.com.au">support@polyfoam.com.au</a><br>
      <1570776887<OK Success<br>
      >1570776887>EXIT<br>
      <1570776887<OK Finished</p>
    <p>But I think that's a red herring.  If I do it for a public
      mailbox that has never had a matching user, I get this:</p>
    <p># /usr/lib/cyrus/bin/sync_client -v -v -n rsync -u
      <a class="moz-txt-link-abbreviated" href="mailto:info2@polyfoam.com.au">info2@polyfoam.com.au</a><br>
      cyrus/sync_client[201121]: couldn't authenticate to backend
      server: no mechanism available<br>
      >1570777011>COMPRESS DEFLATE<br>
      <1570777011<OK DEFLATE active<br>
      USER <a class="moz-txt-link-abbreviated" href="mailto:info2@polyfoam.com.au">info2@polyfoam.com.au</a><br>
      >1570777011>GET USER <a class="moz-txt-link-abbreviated" href="mailto:info2@polyfoam.com.au">info2@polyfoam.com.au</a><br>
      <1570777011<OK Success<br>
    </p>
    <p>and running with the -m option on info2 produces the same
      segfault as above.<br>
    </p>
    <p>
    </p>
    <blockquote type="cite"
      cite="mid:90b6d2f0-924d-4530-93fd-3eeaf95b0e18@www.fastmail.com">
      <pre class="moz-quote-pre" wrap="">On the backup server, what does the "ctl_backups verify -vvv -m polyfoam.com.au!support" command say about the shared mailbox?  </pre>
    </blockquote>
    <p>It segfaults, not the same as above.</p>
    <p># /usr/lib/cyrus/bin/ctl_backups verify -vvv -m
      'polyfoam.com.au!support'<br>
      Segmentation fault (core dumped)<br>
      # coredumpctl gdb -1 <br>
                 PID: 3927 (ctl_backups)<br>
                 UID: 103 (cyrus)<br>
                 GID: 8 (mail)<br>
              Signal: 11 (SEGV)<br>
           Timestamp: Fri 2019-10-11 17:26:10 AEDT (50s ago)<br>
        Command Line: /usr/lib/cyrus/bin/ctl_backups verify -vvv -m
      polyfoam.com.au!support<br>
          Executable: /usr/lib/cyrus/bin/ctl_backups<br>
       Control Group: /user.slice/user-1000.slice/session-1.scope<br>
                Unit: session-1.scope<br>
               Slice: user-1000.slice<br>
             Session: 1<br>
           Owner UID: 1000 (localadmin)<br>
             Boot ID: c887b7eb1d734962b8bddb745df21e8f<br>
          Machine ID: facebc4e2dcd47a68a097acc9077814e<br>
            Hostname: rsync<br>
             Storage:
/var/lib/systemd/coredump/core.ctl_backups.103.c887b7eb1d734962b8bddb745df21e8f.3927.1570775170000000.lz4<br>
             Message: Process 3927 (ctl_backups) of user 103 dumped
      core.<br>
                      <br>
                      Stack trace of thread 3927:<br>
                      #0  0x00007fc24cfdb206 __GI___strlen_sse2
      (libc.so.6)<br>
                      #1  0x0000557f0137c495 backup_get_paths
      (ctl_backups)<br>
                      #2  0x0000557f0136d678 main (ctl_backups)<br>
                      #3  0x00007fc24cf6709b __libc_start_main
      (libc.so.6)<br>
                      #4  0x0000557f0136db6a _start (ctl_backups)<br>
      <br>
      GNU gdb (Debian 8.2.1-2+b1) 8.2.1<br>
      Copyright (C) 2018 Free Software Foundation, Inc.<br>
      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><br>
      This is free software: you are free to change and redistribute it.<br>
      There is NO WARRANTY, to the extent permitted by law.<br>
      Type "show copying" and "show warranty" for details.<br>
      This GDB was configured as "x86_64-linux-gnu".<br>
      Type "show configuration" for configuration details.<br>
      For bug reporting instructions, please see:<br>
      <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/bugs/"><http://www.gnu.org/software/gdb/bugs/></a>.<br>
      Find the GDB manual and other documentation resources online at:<br>
          <a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/documentation/"><http://www.gnu.org/software/gdb/documentation/></a>.<br>
      <br>
      For help, type "help".<br>
      Type "apropos word" to search for commands related to "word"...<br>
      Reading symbols from /usr/lib/cyrus/bin/ctl_backups...Reading
      symbols from
/usr/lib/debug/.build-id/11/23ce6d2f413e1384c144165f996813ad4924c0.debug...done.<br>
      done.<br>
      [New LWP 3927]<br>
      [Thread debugging using libthread_db enabled]<br>
      Using host libthread_db library
      "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
      Core was generated by `/usr/lib/cyrus/bin/ctl_backups verify -vvv
      -m polyfoam.com.au!support'.<br>
      Program terminated with signal SIGSEGV, Segmentation fault.<br>
      #0  __strlen_sse2 () at
      ../sysdeps/x86_64/multiarch/../strlen.S:120<br>
      120    ../sysdeps/x86_64/multiarch/../strlen.S: No such file or
      directory.<br>
      (gdb) bt<br>
      #0  __strlen_sse2 () at
      ../sysdeps/x86_64/multiarch/../strlen.S:120<br>
      #1  0x0000557f0137c495 in backup_get_paths (mbname=0x557f0300bfd0,
      data_fname=0x7ffcbe2daf90, index_fname=0x0, <br>
          create=BACKUP_OPEN_NOCREATE) at backup/lcb.c:373<br>
      #2  0x0000557f0136d678 in main (argc=5, argv=0x7ffcbe2db108) at
      backup/ctl_backups.c:525<br>
      (gdb) up<br>
      #1  0x0000557f0137c495 in backup_get_paths (mbname=0x557f0300bfd0,
      data_fname=0x7ffcbe2daf90, index_fname=0x0, <br>
          create=BACKUP_OPEN_NOCREATE) at backup/lcb.c:373<br>
      373    backup/lcb.c: No such file or directory.<br>
      (gdb) p *mbname<br>
      $2 = {boxes = 0x557f0300c090, is_deleted = 0, localpart = 0x0,
      domain = 0x557f0300c050 "polyfoam.com.au", <br>
        extns = 0x0, extuserid = 0x0, userid = 0x0, intname =
      0x557f0300c030 "polyfoam.com.au!support", extname = 0x0, <br>
        recipient = 0x0}<br>
      (gdb) p userid<br>
      $4 = 0x0<br>
      (gdb) <br>
    </p>
    <p>Calling strlen() on the null userid would be the immediate cause
      of the crash.  I'm not familiar enough with the code to know what
      leads to userid being null, or if that's also the cause of backupd
      crashing.</p>
    <p><br>
    </p>
  </body>
</html>