Project

General

Profile

Newcamd keep alive setting and connection drops

Added by Box Son over 6 years ago

Hi all,

my tvheadend runs at an Ubuntu 16.04.4 LTS (Xenial Xerus) box with two DVBSky DVB-S2 PCIe cards. Ubuntu is up to date.
Some weeks ago tvheadend began to hang every 2 or three days or so. CPU load is at 99.9% and top -H shows tvh:newcamd as the consuming process.
Restarting Ubuntu fixes the problem for another 2-3 days.

Also after restart i can see every 2-3 minutes a peak in cpu load up to 99.9% (TOP-H shows tvh:newcamd as the cause).
At the same moment i can see the following lines at the debug log / syslog:

2018-04-03 11:33:12.054 cwc: newcamdHost:48354: Disconnected
2018-04-03 11:33:12.055 cwc: newcamdHost:48354: Automatic connection attempt in 2 seconds
2018-04-03 11:33:15.055 cwc: newcamdHost:48354: Attemping to connect to server
2018-04-03 11:33:15.140 cwc: newcamdHost:48354: Connected as user tvheadend to a NDS-card-00000000 [CAID:09c4] with 1 provider
2018-04-03 11:33:15.141 cwc: newcamdHost:48354: Connected as user tvheadend to a NDS-card-00000000 [CAID:09c4] with 1 provider
2018-04-03 11:35:20.195 cwc: newcamdHost:48354: Disconnected
2018-04-03 11:35:20.195 cwc: newcamdHost:48354: Automatic connection attempt in 2 seconds
2018-04-03 11:35:23.195 cwc: newcamdHost:48354: Attemping to connect to server
2018-04-03 11:35:23.280 cwc: newcamdHost:48354: Connected as user tvheadend to a NDS-card-00000000 [CAID:09c4] with 1 provider
2018-04-03 11:35:23.280 cwc: newcamdHost:48354: Connected as user tvheadend to a NDS-card-00000000 [CAID:09c4] with 1 provider
2018-04-03 11:37:28.336 cwc: newcamdHost:48354: Disconnected

Seems like every three minutes or so newcamd connection drops and is reestablished.
I've set the keeapalive interval to one second. I've thought this would keep the connection open?

Two questions:
- What causes newcamd connection to drop every 2-3 minutes
- Why does newcamd consume 100% cpu during reestablishing the connection?

Regards

BoxSon


Replies (2)

RE: Newcamd keep alive setting and connection drops - Added by Master Lee almost 6 years ago

Hi BoxSon,

I noticed the same error and can confirm that the CPU load first increases to 100%, then the process crashes and the disconnect occurs. After that the connection is automatically established, as above in your syslog.

After struggling with that problem over the past months I did some research and can now narrow down where the problem is. However, I don't have the ability to write a patch...

What I can say, is that the bug was built into the commit on January 4, 2018.

So all versions before January 4, 2018 work, all versions after have this bug.

And indeed, on January 4, 2018 the following files were modified: cclient, cwc, cccam...

To try it out quickly, you can simply run the following docker command (some path modifications are required), enter a newcamd server, observe the errors:

with the last working version 133 (Dec 3, 2017):

docker create \
  --name=tvheadend \
  --net=bridge \
  -v /opt/tvh/config:/config \
  -v /opt/tvh/rec:/recordings \
  -e PGID=1000 -e PUID=1000  \
  -p 9981:9981 \
  -p 9982:9982 \
  --device=/dev/dvb \
  --device=/dev/dri
  linuxserver/tvheadend:133

The version 134 or above with the bug:

docker create \
  --name=tvheadend \
  --net=bridge \
  -v /opt/tvh/config:/config \
  -v /opt/tvh/rec:/recordings \
  -e PGID=1000 -e PUID=1000  \
  -p 9981:9981 \
  -p 9982:9982 \
  --device=/dev/dvb \
  --device=/dev/dri
  linuxserver/tvheadend:134

More details how to run: https://hub.docker.com/r/linuxserver/tvheadend/

Best regards
Master-Lee

    (1-2/2)