Project

General

Profile

Very slow stopping (restarting) of tvheadend.service

Added by Илья Ваганов over 8 years ago

Hi, friends! This problem persist since tvheadend-git-4.1.r1787.g9abcbec version and on all latest up to tvheadend-git-4.1.r1834.g957b835.

systemctl stop tvheadend.service output:

апр 04 09:59:10 KODI systemd[1]: tvheadend.service: State 'stop-sigterm' timed out. Killing.
апр 04 09:59:10 KODI systemd[1]: tvheadend.service: Main process exited, code=killed, status=9/KILL
апр 04 09:59:10 KODI systemd[1]: Stopped Tvheadend for user vis1.
апр 04 09:59:10 KODI systemd[1]: tvheadend.service: Unit entered failed state.
апр 04 09:59:10 KODI systemd[1]: tvheadend.service: Failed with result 'signal'.


Replies (4)

RE: Very slow stopping (restarting) of tvheadend.service - Added by Илья Ваганов over 8 years ago

For now i solved it by adding “TimeoutStopSec=1” to the “[Service]” section:

[Unit]
Description=Tvheadend for user vis1
After=tmp.mount network.target

[Service]
Type=forking
ExecStart=/usr/bin/tvheadend -a 1 --http_port 8891 --htsp_port 8991 -f -p /var/run/tvheadend_vis1.pid -u vis1
ExecStop=/usr/bin/rm /var/run/tvheadend_vis1.pid
Restart=always
RestartSec=5
*TimeoutStopSec=1*

[Install]
WantedBy=multi-user.target

This way systemd doesn’t wait 90 s before trying to kill whatever it thinks must be stopped and doesn’t want to exit… but only 1 s. This is workaround, not a fix...

RE: Very slow stopping (restarting) of tvheadend.service - Added by Илья Ваганов over 8 years ago

Thanks for fix! :) (tvheadend-git-4.1.r1836.g1681799)

апр 07 14:25:13 KODI tvheadend[19569]: epgdb: save start
апр 07 14:25:13 KODI tvheadend[19569]: epgdb: stored (size 9996948)
апр 07 14:25:13 KODI tvheadend[19569]: STOP: Exiting HTS Tvheadend
апр 07 14:25:13 KODI systemd[1]: Stopped Tvheadend for user vis1.

RE: Very slow stopping (restarting) of tvheadend.service - Added by Martin Bednar over 8 years ago

Hi,

Unless tvheadend monitors its pidfile for removal and acts accordingly, the unit file is wrong. Fix :

[Service]
PIDFile=/var/run/tvheadend_vis1.pid
ExecStop=/usr/bin/kill -QUIT $MAINPID

TimeoutStopSec shouldn't be needed with these two lines.

Maybe ExecStop itself isn't needed, that depends on how tvheadend handles signals.

RE: Very slow stopping (restarting) of tvheadend.service - Added by Илья Ваганов over 8 years ago

Problem fixed since tvheadend-git-4.1.r1836.g1681799. Thanks friends! :)

    (1-4/4)