Am 09.10.26 um 10:01 schrieb Frank Richter:
Am 25.09.26 um 12:57 schrieb Frank Richter:
Am 24.09.26 um 14:48 schrieb Andreas Piesk:
Am 24.09.26 um 13:48 schrieb Frank Richter:

But how to find the cause of the segfault … any hints welcome.


enable core dumps. after a segfault get a backtrace on the dump. binary should not be stripped, symbols are needed. if you can, compile the code with debug info.

On Debian 13 with systemd I installed systemd-coredump and dbgsym and src packages. 
Then coredumpctl info <pid> shows:

        Signal: 11 (SEGV)
     Timestamp: Fri 2026-09-25 11:16:18 CEST (1h 21min ago)
  Command Line: imapd -U 250
    Executable: /usr/lib/cyrus/bin/imapd
…
       Message: Process 2916244 (imapd) of user 109 dumped core.

                Module libzstd.so.1 from deb libzstd-1.5.7+dfsg-1.amd64
                Module libuuid.so.1 from deb util-linux-2.41.5-0+deb13u1.amd64
                Module libgcc_s.so.1 from deb gcc-14-14.2.0-19.amd64
                Module libstdc++.so.6 from deb gcc-14-14.2.0-19.amd64
                Stack trace of thread 2916244:
                #0  0x00007f7c6d27b0b8 prot_vprintf (libcyrus.so.0 + 0x9e0b8)
                #1  0x00007f7c6d27b208 prot_printf (libcyrus.so.0 + 0x9e208)
                #2  0x000055b50b0fe826 cmd_enable (/usr/lib/cyrus/bin/imapd + 
0x17826)
                #3  0x000055b50b119aeb cmdloop (/usr/lib/cyrus/bin/imapd + 
0x32aeb)
                #4  0x000055b50b11e1cb service_main (/usr/lib/cyrus/bin/imapd + 
0x371cb)
                #5  0x000055b50b0f6fac main (/usr/lib/cyrus/bin/imapd + 0xffac)
                #6  0x00007f7c6c635ca8 n/a (libc.so.6 + 0x29ca8)
                #7  0x00007f7c6c635d65 __libc_start_main (libc.so.6 + 0x29d65)
                #8  0x000055b50b0f7631 _start (/usr/lib/cyrus/bin/imapd + 
0x10631)
                ELF object binary architecture: AMD x86-64

coredumpctl debug <pid> … opens gdb
(gdb) backtrace
#0  0x00007f7c6d27b0b8 in prot_vprintf (s=0x0, fmt=0x55b50b1347dc "%s ENABLE", 
pvar=pvar@entry=0x7ffcb5d3d5f0)
    at lib/prot.c:1298
#1  0x00007f7c6d27b208 in prot_printf (s=<optimized out>, fmt=fmt@entry=0x55b50b1347dc 
"%s ENABLE")
    at lib/prot.c:1288
#2  0x000055b50b0fe826 in cmd_enable (tag=0x55b51361fb10 "6") at 
imap/imapd.c:14537
#3  0x000055b50b119aeb in cmdloop () at imap/imapd.c:1775
#4  0x000055b50b11e1cb in service_main (argc=<optimized out>, argv=<optimized 
out>, envp=envp@entry=0x7ffcb5d404f8)
    at imap/imapd.c:1209
#5  0x000055b50b0f6fac in main (argc=<optimized out>, argv=<optimized out>, 
envp=0x7ffcb5d404f8)
    at master/service.c:647

in prot_vprintf s == NULL!
in prot_printf s == NULL!
in cmd_enable  prot_printf(be->out, …   be->out is == NULL
(gdb) print *be   shows the according backend server (we have a murder), but 
out == NULL. So no backend connection?

The client (SOGo webmail) sends: 6 ENABLE QRESYNC

The server runs cyrus-imapd-3.10.3 (self build with Debian patches), 2 frontends, 2 backend servers, 1 mupdate master (on frontend).

Any ideas how to handle this? For me it’s apparently a bug. Shall I open an 
issue?

open an issue is a good idea, seems a bug to me too.

you could skip dead backend like this:

int enabled_on_be = 0;

    for (int i = 0; i < ptrarray_size(&backend_cached); i++) {
        struct backend *be = ptrarray_nth(&backend_cached, i);

        if (!be->out) continue; // skip dead be

        prot_printf(be->out, "%s ENABLE", tag);
        prot_print_client_capa(be->out, new_capa);
        prot_puts(be->out, "\r\n");
        pipe_until_tag(be, tag, 0);
        enabled_on_be = 1;
    }

    if (!enabled_on_be) {
        /* RFC 9051, 6.3.1:
         * ENABLED is sent even if nothing was enabled */
        prot_puts(imapd_out, "* ENABLED");
        prot_print_client_capa(imapd_out, new_capa);
        prot_puts(imapd_out, "\r\n");
    }

but that's not sufficient because the skipped dead backends never get the 
ENABLE, I haven't found some kind of replay or sync of capabilities.

the client also can get multiple ENABLED responses if there are multiple 
backends but maybe that's not an issue.



Maybe this helps:

Frontend:
2026-10-09T08:29:11.830162+02:00 sara cyrus/imap[3169994]: starttls: TLSv1.3 
with cipher TLS_AES_256_GCM_SHA384 (256/256 bits new) no authentication
2026-10-09T08:29:12.001845+02:00 sara cyrus/imap[3169994]: login: 
<webmailserver>.hrz.tu-chemnitz.de [2001:638:911:…] <user> plaintext+TLS User logged 
in SESSIONID=<cyrus-1791527351-3169994-1-17718288318570077703>
2026-10-09T08:29:12.048449+02:00 sara cyrus/imap[3169994]: client id 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> userid=<user>: 
"x-originating-ip" "…"

Connecting to backend 1:
2026-10-09T08:29:12.313025+02:00 sara cyrus/imap[3169994]: auditlog: proxy user 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> 
remote=<cyrus-1791527352-456775-1-14270469474560480099>
2026-10-09T08:29:14.749938+02:00 sara cyrus/imap[3169994]: client id 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> userid=<user>: 
"x-originating-ip" "…"

Connecting to backend 2:
2026-10-09T08:29:15.543297+02:00 sara cyrus/imap[3169994]: auditlog: proxy user 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> 
remote=<cyrus-1791527355-312810-1-7932546438329846099>
2026-10-09T08:30:07.064339+02:00 sara cyrus/imap[3169994]: client id 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> userid=<user>: 
"x-originating-ip" "…"
2026-10-09T08:35:14.084474+02:00 sara cyrus/imap[3169994]: client id 
sessionid=<cyrus-1791527351-3169994-1-17718288318570077703> userid=<user>: 
"x-originating-ip" "…"

… then the client (webmail server) sends the ENABLE QRESYNC, and imapd dies:

segfault core dump:
            PID: 3169994 (imapd)
         Signal: 11 (SEGV)
      Timestamp: Fri 2026-10-09 08:35:14 CEST
   Command Line: imapd -U 250
     Executable: /usr/lib/cyrus/bin/imapd

Backend 1 = packet: This is where the user’s INBOX is located
2026-10-09T08:29:12.312738+02:00 packet cyrus/imap[456775]: login: 
<frontend>.hrz.tu-chemnitz.de [2001:638:911…] user SCRAM-SHA-256 User logged in 
SESSIONID=<cyrus-1791527352-456775-1-14270469474560480099>
2026-10-09T08:35:14.393819+02:00 packet cyrus/imap[456775]: session ended: 
sessionid=<cyrus-1791527352-456775-1-14270469474560480099> userid=<user> id.name=<(null)> 
condstore=<1> qresync=<1>

Backend 2 = parcel: with a shared mailbox the user has access to
2026-10-09T08:29:15.542749+02:00 parcel cyrus/imap[312810]: login: 
<frontend>.hrz.tu-chemnitz.de [2001:638:911…] user SCRAM-SHA-256 User logged in 
SESSIONID=<cyrus-1791527355-312810-1-7932546438329846099>
2026-10-09T08:34:15.359427+02:00 parcel cyrus/imap[312810]: session ended: 
sessionid=<cyrus-1791527355-312810-1-7932546438329846099> userid=<user> 
id.name=<(null)>

… this connection was closed!

code in imap/imapd.c

14532     if (ptrarray_size(&backend_cached)) {
14533         /* ENABLE on all remote mailboxes */
14534         for (int i = 0; i < ptrarray_size(&backend_cached); i++) {
14535             struct backend *be = ptrarray_nth(&backend_cached, i);
14536
14537             prot_printf(be->out, "%s ENABLE", tag);

(gdb) print *be
$1 = {hostname = "parcel.…", '\000' <repeats 38 times>,
   banner = "* OK [CAPABILITY IMAP4rev1 IMAP4rev2 AUTH=SCRAM-SHA-256 ENABLE ID 
LITERAL+ LOGINDISABLED SASL-IR STARTTLS MUPDATE=mupdate:/…/] parcel.… Cyrus IMAP 
3.10.3-Deb"..., addr = {ss_family = 10,
     __ss_padding = "\000\217\000\000\000\000 
\001\0068\t\021\v\016\0014\001\t\002(\002U", '\000' <repeats 95 times>, __ss_align = 
0}, sock = -1,
   prot = 0x5612f3a4f020 <imap_protocol>, context = 0x0, clientin = 0x0, 
current = 0x0, inbox = 0x0, timeout = 0x0, saslconn = 0x0, sasl_cb = 0x0,
   ext_ssf = 0, tlsconn = 0x0, tlssess = 0x0, capability = 0, num_cap_params = 
0, cap_params = 0x0, last_result = {s = 0x0, len = 0, alloc = 0,
     flags = 0}, in = 0x0, *out = 0x0*}

Thanks,
Frank

--
Frank Richter, Chemnitz University of Technology, Germany

*Cyrus <https://cyrus.topicbox.com/latest>* / Info / see discussions 
<https://cyrus.topicbox.com/groups/info> + participants 
<https://cyrus.topicbox.com/groups/info/members> + delivery options 
<https://cyrus.topicbox.com/groups/info/subscription> Permalink 
<https://cyrus.topicbox.com/groups/info/T9e1e24185b6d5bc3-M3867dcd5872ec7f820c3d45a>


--


------------------------------------------
Cyrus: Info
Permalink: 
https://cyrus.topicbox.com/groups/info/T9e1e24185b6d5bc3-Mac73fa9316d9447843c92b52
Delivery options: https://cyrus.topicbox.com/groups/info/subscription

Reply via email to