On Ubuntu 20.00 amd64
from journalctl -u tvheadend -f
Mar 27 16:58:57 tvhe-2 systemd[1]: Stopping Tvheadend - a TV streaming server and DVR...
Mar 27 17:00:27 tvhe-2 systemd[1]: tvheadend.service: State 'stop-sigterm' timed out. Killing.
user@tvhe-2:~# cat /lib/systemd/system/tvheadend.service
[Unit]
Description=Tvheadend - a TV streaming server and DVR
# Add existing services you want started before Tvheadend, e.g, mount
# units..
# After=auditd.service syslog.target network.target local-fs.target mnt-recordings.mount
# See "man systemd.mount" or view https://www.freedesktop.org/software/systemd/man/systemd.mount.html
After=auditd.service syslog.target network.target local-fs.target
[Service]
EnvironmentFile=/etc/default/tvheadend
ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid $OPTIONS
PIDFile=/run/tvheadend.pid
Type=forking
Restart=on-failure
RestartSec=54s
# To enable watchdog functionality, uncomment these, remove Type=forking
# and compile with --enable-libsystemd_daemon
#Type=notify
#WatchdogSec=1m
#TimeoutStartSec=5m
#TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
user@tvhe-2:~#
build options are
AUTOBUILD_CONFIGURE_EXTRA="--enable-gperftools --enable-kqueue --enable-ccdebug --enable-libfdkaac --enable-gtimer_check --enable-slow_memoryinfo --enable-vaapi --enable-nvenc --disable-hdhomerun_client --disable-hdhomerun_static"
This page has the same message
https://tvheadend.org/d/3706-very-slow-stopping-restarting-of-tvheadend-service but as it appears to have been fixed in 4.1 it might be a red herring