nicm/fdm

Crash on mail_destroy

MyLordAngus opened this issue · 2 comments

I'm executing fdm periodically every 15 minutes after running mbsync. This is done through a systemd user service using a ExecPostStart command. Sometimes, my mails are not redispatched accross my mailboxes and I notice that fdm has crashed. If I restart my mbsync service, fdm is able to execute and my mails are then sorted as expected.

Here is the output of the systemd service status :

May 04 11:00:34 miskatonic systemd-coredump[28165]: [🡕] Process 28163 (fdm) of user 1000 dumped core.

                                                    Stack trace of thread 28163:
                                                    #0  0x0000000000000789 n/a (n/a + 0x0)
                                                    ELF object binary architecture: AMD x86-64
May 04 11:00:34 miskatonic systemd[919]: mbsync.service: Control process exited, code=exited, status=1/FAILURE
May 04 11:00:34 miskatonic systemd[919]: mbsync.service: Failed with result 'exit-code'.
May 04 11:00:34 miskatonic systemd[919]: Failed to start Fetch mails.

Here is the backtrace using gdb

Core was generated by `/usr/bin/fdm fetch'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000000789 in ?? ()
[ ## gdb ## ] bt
#0  0x0000000000000789 in ?? ()
#1  0x000056457fcfa930 in mail_destroy (m=0x5645809a5a70) at /usr/src/debug/fdm/fdm-2.2/mail.c:129
#2  fetch_free1 (mctx=mctx@entry=0x5645809c9020) at /usr/src/debug/fdm/fdm-2.2/child-fetch.c:269
#3  0x000056457fcfad49 in fetch_dequeue (a=a@entry=0x56458098abe0, mctx=mctx@entry=0x5645809c9020) at /usr/src/debug/fdm/fdm-2.2/child-fetch.c:731
#4  0x000056457fcfeb5f in fetch_match (msgbuf=0x7ffc95414e90, msg=0x0, a=0x56458098abe0) at /usr/src/debug/fdm/fdm-2.2/child-fetch.c:191
#5  fetch_account (tim=1683190834.374949, nflags=0, pio=0x56458098b270, a=0x56458098abe0) at /usr/src/debug/fdm/fdm-2.2/child-fetch.c:386
#6  child_fetch (child=child@entry=0x56458098b220, pio=pio@entry=0x56458098b270) at /usr/src/debug/fdm/fdm-2.2/child-fetch.c:114
#7  0x000056457fd001d9 in child_start (children=0x7ffc954156d0, uid=0, gid=0, start=0x56457fcfdeb0 <child_fetch>, msg=<optimized out>, data=<optimized out>, parent=0x0)
    at /usr/src/debug/fdm/fdm-2.2/child.c:133
#8  0x000056457fcf9c18 in main (argc=<optimized out>, argv=0x7ffc95417df0) at /usr/src/debug/fdm/fdm-2.2/fdm.c:773

For the context, I'm using ArchLinux with fdm 2.2.

nicm commented

What does f 1 then p *m show in gdb?

Sorry completely forgot to anwser. It seems the crash are less frequent but still there this morning. Here is the result of the command you gave me :

[ ## gdb ## ] p *m
$1 = {
  idx = 3,
  tim = 1690354838.392879,
  tags = 0x0,
  shm = {
    name = "fdm.XXXX757sNq", '\000' <repeats 240 times>,
    fd = 5,
    data = 0x7fa506be5000,
    size = 16384
  },
  attach = 0x0,
  attach_built = 0,
  base = 0x7fa506be5000 "Return-Path: <devnexen@gmail.com>\nX-Original-To: adenoyelle@moxy.haproxy.com\nDelivered-To: adenoyelle@moxy.haproxy.com\nReceived: by localhost (fdm 2.2, account \"haproxy\")  \twith maildir (unencrypted) "...,
  data = 0x7fa506be5000 "Return-Path: <devnexen@gmail.com>\nX-Original-To: adenoyelle@moxy.haproxy.com\nDelivered-To: adenoyelle@moxy.haproxy.com\nReceived: by localhost (fdm 2.2, account \"haproxy\")  \twith maildir (unencrypted) "...,
  off = 0,
  size = 5788,
  space = 16384,
  body = 4456,
  wrapped = {
    list = 0x0,
    num = 0,
    space = 0
  },
  wrapchar = 0 '\000',
  rml = {
    valid = 1,
    list = {
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      },
      {
        valid = 0,
        so = 0,
        eo = 0
      }
    }
  },
  decision = DECISION_KEEP,
  auxfree = 0x789,
  auxdata = 0x7d7
}