Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Log core dump files on systemd/Ubuntu?

Ubuntu 20.04.4/mosquitto 2.0.14 from the ppa

Periodically (anywhere between every few hours and every few days), I'm getting journal entries like this 

    Apr 18 07:44:19 mittServer systemd[1]: mosquitto.service: Main process exited, code=dumped, status=11/SEGV
    Apr 18 07:44:19 mittServer systemd[1]: mosquitto.service: Failed with result 'core-dump'.

Nothing special in /var/log/mosquitto.log to correspond it. It just shows that it started up at that point after a new connection:

    2022-04-18T07:44:19: New connection from on port 8883.
    2022-04-18T07:44:19: mosquitto version 2.0.14 starting
    2022-04-18T07:44:19: Config loaded from /etc/mosquitto/mosquitto.conf.

I *am* running a auth plugin. So there's a good chance this is me. I'm trying to gather some more data on what's going on. It appears that by default coredumps are not logged automatically on Ubuntu. ulimit is zero by default. So I made a one line tweak of /lib/systemd/system/mosquitto.service

    $ cat /lib/systemd/system/mosquitto.service
    Description=Mosquitto MQTT Broker
    Documentation=man:mosquitto.conf(5) man:mosquitto(8)
    ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
    ExecReload=/bin/kill -HUP $MAINPID
    ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
    ExecStartPre=/bin/chown mosquitto /var/log/mosquitto
    ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto
    ExecStartPre=/bin/chown mosquitto /run/mosquitto
    # I added the following line

But for whatever reason, I'm still not getting a coredump in /var/lib/apport/coredump.

I wrote a tiny C program that sigseg's periodically and wrapped it in a systemd.service, and it dumps the coredump just fine (as long as I set the LimitCORE value appropriately). 

I'm just trying to get a feel for where the sigseg is originating at. Has anyone else figured out how to do this (capture the coredump file). Is there a better approach for this? I could shutdown the systemd service and just run it from the command line I guess?

Back to the top