[mythtv-users] Inhibit crash dumps

Stephen Worthington stephen_agent at jsw.gen.nz
Sun May 10 09:37:40 UTC 2020


On Sun, 10 May 2020 09:58:45 +0100, you wrote:

>MythTV Version : v31.0-38-ga2b8c262dc on Ubuntu 20.04
>
>The frontend is working fine but crashing on exit. This occurs on one of 
>my frontends but not others.
>
>mythshutdown also core dumps on exit when running on my Ubuntu 19.10 server.
>
>Both work fine but on one of my frontends it keeps creating a large core 
>dump file in /var/crash
>
>ie /var/crash/usr_bin_mythfrontend.real.1000.crash
>
>Does any body know how to stop the core dump files being created

I think that involves the ulimit command to set the crash dump file
size to 0.  And if you look at /etc/security/limits.d/ (in Ubuntu), I
think you can add a config file there to match a program and provide
individual settings for it.  But I have not actually ever done that,
so google to see the right way of doing it.

When you get a core dump, did the program exit normally, or did you
need to kill it?  If the latter, instead of using kill -9, try using
the ordinary kill command (aka kill -15) twice.  For a long time
MythTV programs have had a problem where they try to shut down on the
first kill command, but one thread fails to shut down.  If you do a
second ordinary kill command, that last thread shuts down normally, so
there is no crash.

If you are using systemd to shut the MythTV program down, then systemd
on its default settings will do an ordinary kill command once to tell
a program to shut down, and then if the program fails to shut down, it
will do a kill -9 after a timeout.  You can change that to making
systemd do two ordinary kill commands with a short delay between them
by adding an override for the systemd settings.  I have this set up
for mythbackend, where I add an override line (using sudo systemctl
edit mythtv-backend):

[Service]
ExecStop=/usr/local/bin/mythbackendstop.sh

And then /usr/local/bin/mythbackendstop.sh does this:

#!/bin/bash
PID=$(systemctl show -p MainPID mythtv-backend.service 2>/dev/null |
cut -d= -f2)
if [ "$PID" != "0" ]; then
    kill -15 $PID
    sleep 1
    kill -15 $PID
fi

The PID= line is all one long line - my email client wraps long lines.

Doing this makes my system shut down much faster as it does not have
to wait for a timeout before systemd finally does a kill -9 for
mythbackend.


More information about the mythtv-users mailing list