dfigus / addon-tvheadend

TVHeadend - Home Assistant Add-on
MIT License
3 stars 0 forks source link

Server not accessible since HAOS 12.0 Update #136

Closed obert0 closed 3 months ago

obert0 commented 4 months ago

The Problem

Since the last HAOS update the TvHeadend server wont start on the WebUI. I tried to open the server from HA inside the addon and from chrome. The server isn't responsive. Here the addon logs after I try to acces the server from HA. I don't see response in the log when attempt to connect from a browser.

Environment

Logs

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting

-----------------------------------------------------------
 Add-on: TVHeadend
 TV streaming server and recorder
-----------------------------------------------------------
 Add-on version: 5.1.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.0  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.2.4
 Home Assistant Supervisor: 2024.02.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/nginx.sh
[21:57:00] INFO: Ingress path used for nginx:  /api/hassio_ingress/2DWZmkHSrwmuk_rQAqElAOy7TtLtv_PZxnvgYNlhyJM
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-customizations: starting
s6-rc: info: service init-customizations successfully started
s6-rc: info: service init-tvheadend: starting
s6-rc: info: service init-tvheadend successfully started
s6-rc: info: service init-comskip: starting
s6-rc: info: service tvheadend: starting
s6-rc: info: service tvheadend successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
[21:57:00] INFO: Starting TVHeadend...
[21:57:00] INFO: Starting nginx...
[21:57:00] INFO: Updating comskip.ini
s6-rc: info: service init-comskip successfully started
[21:57:00] INFO: Additional args 
s6-rc: info: service legacy-services: starting
[21:57:00] INFO: Ingress path used as tvheadend http_root:  /api/hassio_ingress/2DWZmkHSrwmuk_rQAqElAOy7TtLtv_PZxnvgYNlhyJM
2024-02-27 21:57:00.778 [   INFO] main: Log started
2024-02-27 21:57:00.778 [   INFO] config: Using configuration from '/config/tvheadend'
2024-02-27 21:57:00.778 [   INFO] http: Starting HTTP server 0.0.0.0:9981
2024-02-27 21:57:00.778 [   INFO] htsp: Starting HTSP server 0.0.0.0:9982
2024-02-27 21:57:00.807 [   INFO] config: loaded
2024-02-27 21:57:00.807 [   INFO] config: scanfile (re)initialization with path <none>
2024-02-27 21:57:00.807 [   INFO] transcode: 'video' context type registered
2024-02-27 21:57:00.807 [   INFO] transcode: 'audio' context type registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHH264Decoder' decoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHTHEORADecoder' decoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHAACDecoder' decoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHVORBISDecoder' decoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHOPUSDecoder' decoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHMPEG2VIDEOEncoder' encoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHH264Encoder' encoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHHEVCEncoder' encoder helper registered
2024-02-27 21:57:00.807 [   INFO] transcode: '&TVHAACEncoder' encoder helper registered
2024-02-27 21:57:00.807 [   INFO] codec: 'mpeg2video' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'mp2' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'aac' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'vorbis' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'flac' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libx264' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libx265' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libvpx' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libvpx-vp9' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libtheora' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libvorbis' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'libopus' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'h264_vaapi' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'hevc_vaapi' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'vp8_vaapi' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'vp9_vaapi' encoder registered
2024-02-27 21:57:00.807 [   INFO] codec: 'webtv-vp8' codec profile created
2024-02-27 21:57:00.807 [   INFO] codec: 'webtv-h264' codec profile created
2024-02-27 21:57:00.807 [   INFO] codec: 'webtv-aac' codec profile created
2024-02-27 21:57:00.807 [   INFO] codec: 'webtv-vorbis' codec profile created
2024-02-27 21:57:00.809 [   INFO] descrambler: adding CAID 2600/FFFF as ConstCW interval 10000ms pc 20 ep default (BISS)
2024-02-27 21:57:00.809 [   INFO] descrambler: adding CAID 0E00/FFFF as MultiPID interval 1000ms pc 2 ep default (PowerVu)
2024-02-27 21:57:00.810 [   INFO] iptv: Using 2 input thread(s)
s6-rc: info: service legacy-services successfully started
2024/02/27 22:01:26 [error] 206#206: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxxXXXxxx, server: , request: "GET / HTTP/1.1", upstream: "xxxXXXxxx:9981/api/hassio_ingress/2DWZmkHSrwmuk_rQAqElAOy7TtLtv_PZxnvgYNlhyJM/", host: "xxxXXXxxx:8123", referrer: "xxxXXXxxx:8123/hassio"
2024/02/27 22:02:26 [error] 206#206: *1 upstream timed out (110: Operation timed out) while reading response header from upstream, client: xxx.xxx.xx.xx, server: , request: "GET / HTTP/1.1", upstream: "xxx.xxx.xxx.xxx:9981/api/hassio_ingress/2DWZmkHSrwmuk_rQAqElAOy7TtLtv_PZxnvgYNlhyJM/", host: "xxxXXXxxx:8123", referrer: "xxxXXXxxx:8123/hassio"
dfigus commented 4 months ago

@obert0 I did not update to HA OS 12 yet and will only be able to do this on the weekend. But can you try to access TVH directly via http://<HA URL/IP>:9981 (as the addon runs in host network mode)? This will skip the HA ingress & nginx from the container. From the last two log entries there seems to be an connection issue between nginx and TVH...

obert0 commented 4 months ago

Yes I tried with the address too. I also tried with the local addon I did for the full acces mode and my other addon fork from GauthamVarmaK. All TVHeadend addon server aren't accessible. I have also Jellyfin addon and this one is still accessible on his port. Maybe this is a bug from the HAOS itself.

dfigus commented 4 months ago

I upgraded just a few minutes ago and everything came back without an issue. But I'm on a RPI4 (aarch64), maybe this only occurs on x86_64.

Can you try the following and report the results:

Get into the addon container

You can use the advanced SSH addon:

  1. docker ps -> search for the line for the addon and make note of the first characters of the container id so that it's unique.
  2. docker exec -it <container ID characters> bash now you should be in the addon container

Check for running TVH process

  1. Run top and paste the results here
  2. Run ps -a | grep tvheadend and past the results here
obert0 commented 4 months ago

Hi @dfigus ,

This is the result of top:

Mem: 7412160K used, 548796K free, 4116K shrd, 293024K buff, 5132120K cached
CPU:   0% usr   0% sys   0% nic  98% idle   0% io   0% irq   0% sirq
Load average: 0.06 0.12 0.10 1/1003 253
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
  173    26 root     Z        0   0%   1   0% [tvheadend]
  226   204 nginx    S    10056   0%   3   0% nginx: worker process
  227   204 nginx    S    10056   0%   3   0% nginx: worker process
  224   204 nginx    S    10056   0%   2   0% nginx: worker process
  225   204 nginx    S    10056   0%   2   0% nginx: worker process
  204   179 root     S     9600   0%   2   0% nginx: master process nginx -g daemon off;error_log /dev/stdout error;
  179    27 root     S     4160   0%   0   0% bash /usr/bin/bashio ./run nginx
  244     0 root     S     2620   0%   3   0% bash
  253   244 root     R     1624   0%   0   0% top
    1     0 root     S      440   0%   0   0% /package/admin/s6/command/s6-svscan -d4 -- /run/service
   28     1 root     S      216   0%   1   0% s6-supervise s6rc-oneshot-runner
   27     1 root     S      216   0%   3   0% s6-supervise nginx
   25     1 root     S      216   0%   0   0% s6-supervise s6rc-fdholder
   16     1 root     S      216   0%   0   0% s6-supervise s6-linux-init-shutdownd
   26     1 root     S      216   0%   1   0% s6-supervise tvheadend
   36    28 root     S      208   0%   1   0% /package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/admin/s6/command/s6-sudod -t 30000
   19    16 root     S      204   0%   3   0% /package/admi

And this the result of ps -a | grep tvheadend:

   26 root      0:00 s6-supervise tvheadend
  173 root      0:04 [tvheadend]
  258 root      0:00 grep tvheadend
dfigus commented 4 months ago

That looks fine so far. I guess you removed the actual TVH command line options. Can you please share the complete TVH line (you may mask the IP of your satip_xml argument)?

Do you have any other TVH processes running that could occupy port 9981 on the host? Can you check whether there is something in the output of docker ps?

Furthermore we could analyze the processes listening on ports. For this do this - first let's do it in the addon container:

  1. Install net-tools via apk add net-tools
  2. Run netstat: netstat -tulpn | grep LISTEN and paste the results here.

The entries which have an entry in the last column (e.g. tvheadend & nginx) are processes from the addon container. Can you spot duplicates on 9981?

obert0 commented 3 months ago

Hi @dfigus, I installed the last addon version and it doesn't work. I had to disable autostart, reboot and now everything work as expected. I don't really know the problem but it work!