Mailing List Archive

Inhibit crash dumps
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

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps [ In reply to ]
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.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps (fixed) [ In reply to ]
On 10/05/2020 10:37, Stephen Worthington wrote:
> 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.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org

Thanks

Setting limits.conf in /etc/security/limits.d to
* soft core 0
* hard core 0
worked

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps [ In reply to ]
On 10/05/2020 09:58, John 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
>

If you can get a backtrace of the crash then maybe we can fix it then
this wouldn't be a problem?

https://www.mythtv.org/wiki/Debugging


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps [ In reply to ]
On 10/05/2020 12:38, Paul Harrison wrote:
> On 10/05/2020 09:58, John 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
>>
>
> If you can get a backtrace of the crash then maybe we can fix it then
> this wouldn't be a problem?
>
> https://www.mythtv.org/wiki/Debugging
>
>
> Paul H.
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org

I think the issue is known and being currently discussed on
http://irc.mythtv.org/ircLog/channel/4/2020-05-09

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps [ In reply to ]
On 10/05/2020 13:55, John wrote:
> On 10/05/2020 12:38, Paul Harrison wrote:
>> If you can get a backtrace of the crash then maybe we can fix it then
>> this wouldn't be a problem?
>>
>> https://www.mythtv.org/wiki/Debugging
>>
>>
> I think the issue is known and being currently discussed on
> http://irc.mythtv.org/ircLog/channel/4/2020-05-09
>
>

Ha! Ha! No that's just a few devs being divas nothing new there \0/  .


That's a desperate issue and nothing to do with the shutting down issues
you seem to be reporting here. The mythshutdown crash is new to me at least.


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Inhibit crash dumps (fixed) [ In reply to ]
On 05/10/20 07:00, John <jksjdevelop@gmail.com> wrote:
> On 10/05/2020 10:37, Stephen Worthington wrote:
>> 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.
>>
>> <snip>

> Setting limits.conf in /etc/security/limits.d to
> * soft core 0
> * hard core 0
> worked
>
Just be aware that /etc/security/limits.d settings apply to *everything* on the system, so you won't get core files for any crashes and a non-root user cannot override these settings.  If you want to apply the 'no core' controls to just one program, like mythfrontend, you can put the appropriate ulimit commands in a script that then exec's the program.  Something like:

#!/bin/bash
ulimit -c 0
exec /bin/ls

One extra Linux hint: If you don't like where core files are being placed, you can define a location with the kernel.core_pattern sysctl setting.  For example:

kernel.core_pattern = /tmp/%u-%s-%t-%e-%p.core

This pattern generates a name with the process uid, signal, time, executable name, and pid.  See the core(5) man page  for details on all of the % interpolations.

Keith

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org