TVHeadend service starts only 10-20 min after boot up
Added by Levente Cseh about 9 years ago
I did upgrade from 3.9 and I am upgrading regularly to 4.1 master, and ever since I changed to 4.x, the TVH service starts with a 10-20 minute delay. The server is a decent i3 CPU hardware with 16Gb RAM, and there is nothing else that would keep the server busy. Whenever I update something and needs reboot I have to count with this delay all the time.
Can you please point out what could be wrong? The TVH config is too complex, I cannot reinstall the whole PC.
Replies (10)
RE: TVHeadend service starts only 10-20 min after boot up - Added by Mark Clarkstone about 9 years ago
I've read some people having slow start-ups due to very large configurations mainly caused by the amount of files tvheadend has to read before it becomes usable.
It sounds like you're having the same issue, the only solution is to delete older unused services/muxes from your config for now, but it is known.
See: #3134, feel free to add to the ticket if you like.
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh about 9 years ago
It might be a reason, but I doubt it is because of the huge config. As I said, the config was the same before I upgraded. It is somehow related to the upgrade itself. Did many TVH installations, and this could be reproduced easily after major release upgrades.
The question is rather, how to debug this in order to find out what is taking that long. I'm really not into reinstalling this system...
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh almost 9 years ago
I was messing around with deleting "unnecessary" files from the hts folder, and I came across the backup directory that contained lots of huge compressed archives. (Can somebody tell me please what are these used for?).
Actually I deleted them all, and I've noticed that TVH starts to rebuild one file, which gets to ~600M in size....(No idea where this size comes from) then it decreases again, starts from scratch, like it was crashing during compression. As TVheadend service is not active during this time, I suspect it has to do something with this.
Any idea?
RE: TVHeadend service starts only 10-20 min after boot up - Added by Mark Clarkstone almost 9 years ago
The files in ./backup are just that backups of your config minus any other backups and sock files. It will do it each time you upgrade Tvheadend or whenever a backup for your current version doesn't exist. Use --nobackup arg to prevent it.
RE: TVHeadend service starts only 10-20 min after boot up - Added by Prof Yaffle almost 9 years ago
Interesting...
The backups are created when you install a new version - so they're effectively zipped archives of your whole config prior to any changes introduced by the new version.
They should be created as you install and start the application for the first time... after that, they shouldn't be re-created - mine certainly aren't, Ive restarted a few times recently and the latest backup is from a week ago, when I last upgraded.
Mine are also only a few meg in size, although there are rather a lot of them that go back over a year.
Soooo....
1. Is this huge delay only when you've just upgraded? Or is it there on a restart as well? I suspect the latter from what you said.
2. What's in your config directory (e.g. /home/hts/.hts/tvheadend)? You could use something like du --max-depth=1 -B M |sort -rn
to get a sorted top-level list of the biggest subdirectories, and then crawl down from there to see where the issue is.
It sounds like you have a vast file somewhere that either needs compressing or else is just taking forever to read in and/or timeout on start. EPG database, perhaps...?
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh almost 9 years ago
Ok, I forgot to add that I am following the updates, so it actually updates on an almost daily basis.
1. It persist whatever I do, after a restart of the service or the whole server.
2. I deleted all my recordings, but apparently these are not included in the backup, as the size of the archive is still the same. I guess it should be the EPG. I have a rather complicated config with 4 DVB-S2 and 4 DVB-T cards, the first ones have 4 dishes hooked onto themselves with multiswitches.
I will check the file sizes according to your suggestions.
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh almost 9 years ago
Mark Clarkstone wrote:
The files in ./backup are just that backups of your config minus any other backups and sock files. It will do it each time you upgrade Tvheadend or whenever a backup for your current version doesn't exist. Use --nobackup arg to prevent it.
Mark,
Sorry for the dumb question, if I have Tvheadend started with the default upstart service, how can I still force it to start without the backup option? Is there a way to edit this startup script?
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh almost 9 years ago
Ok... improvements...
So as I said today morning it got stucked with the backup and it would not start anymore. Following Mark's suggestion I modded the upstart service like this:
- tvheadend - DVB/IPTV streaming server #
- Tvheadend is a TV streaming server for Linux supporting DVB, ATSC, IPTV,
- and Analog video (V4L) as input sources.
description "Tvheadend DVB/IPTV streaming server"
author "Adam Sutton <[email protected]>"
start on (local-filesystems and net-device-up and started udev-finish)
stop on runlevel [!2345]
expect fork
respawn
script
[ -r /etc/default/tvheadend ] && . /etc/default/tvheadend
[ "$TVH_ENABLED" = "1" ] || exit 0
ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"
exec tvheadend --nobackup $ARGS $TVH_ARGS
end script
Notice the only "--nobackup" argument at the end. This literally solved the issue, and the service was immediately up and running as it should have been.
Now this appeared after I did the major update from 3.9 to 4.x, so the backup system got some inconsistency in between. I'm going to inspect the content of my TVH folder, as the truth lies in there, I only need a ray of light to find it...
RE: TVHeadend service starts only 10-20 min after boot up - Added by Mark Clarkstone almost 9 years ago
Levente Cseh wrote:
Ok... improvements...
So as I said today morning it got stucked with the backup and it would not start anymore. Following Mark's suggestion I modded the upstart service like this:
- tvheadend - DVB/IPTV streaming server #
- Tvheadend is a TV streaming server for Linux supporting DVB, ATSC, IPTV,
- and Analog video (V4L) as input sources.
description "Tvheadend DVB/IPTV streaming server"
author "Adam Sutton <[email protected]>"start on (local-filesystems and net-device-up and started udev-finish)
stop on runlevel [!2345]expect fork
respawnscript
[ -r /etc/default/tvheadend ] && . /etc/default/tvheadend[ "$TVH_ENABLED" = "1" ] || exit 0
ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"exec tvheadend --nobackup $ARGS $TVH_ARGS
end scriptNotice the only "--nobackup" argument at the end. This literally solved the issue, and the service was immediately up and running as it should have been.
Now this appeared after I did the major update from 3.9 to 4.x, so the backup system got some inconsistency in between. I'm going to inspect the content of my TVH folder, as the truth lies in there, I only need a ray of light to find it...
You could have just added --nobackup (or -B) to ARGS (ARGS="-B -f") rather than edit it on the exec line :p
RE: TVHeadend service starts only 10-20 min after boot up - Added by Levente Cseh almost 9 years ago
I'll try that, I'm not a scripting master, so I tried to avoid big mistakes... :-)