v17 Crash while playing live TV - Memory leak
#1
Hi,

I have an issue with Kodi crashing after a while when playing live TV from my TvHeadend backend. The video plays fine normally, then will stutter a few times before freezing completely. At this point Kodi locks up and a minute or so later, quits.

Here's the debug log from one instance of the crash: https://pastebin.com/WenhHDsD

I'm running Kodi 17.4 on Ubuntu 16.04, with TvHeadend 4.2.3. The HTS client addon for Kodi is version 3.4.27 (according to apt-get). I think the problem started when I upgraded TvHeadend from version 4.0 to 4.2, but I can't be completely sure.

Any ideas what might be causing this?

Cheers,
Jon
Reply
#2
Looking at the log it appears a script gets run that is trying to shut down Kodi right about when you start playback, and right after that, packets are lost from Tvheadend to Kodi.

To make sure it's not some weird configuration change, try it with a clean installation. The easiest way to to create a new user, login as that new user, run Kodi and setup only the PVR addon and then test. If that works fine, then the problem is with your local configuration.
Reply
#3
(2017-10-08, 15:49)rpcameron Wrote: Looking at the log it appears a script gets run that is trying to shut down Kodi right about when you start playback, and right after that, packets are lost from Tvheadend to Kodi.

Hi,

Which line are you looking at that says a script is being run?

I can see the video starting at line 669 (21:16:25.240 T:140344351426944  NOTICE: VideoPlayer: Opening: pvr://channels/tv/All channels/pvr.hts_1112442234.pvr), and completing around line 850. The buffer timeout warnings start immediately after the stream starts playing, however, the video continues to play for 30 minutes or so before Kodi eventually dies.

I haven't had a chance to test this in isolation with a new user yet, so I can't be sure it isn't a configuration problem, as you say.

Cheers,
Jon
Reply
#4
Starting at line 928. It seems to be Ctrl+Alt+B, which is set to activate userdata/macros/power-off.py
Reply
#5
Ah, that's just a keybinding used to call a script which disables the video output when I turn the TV off. The script isn't actually being run at any time in the log.
Reply
#6
Well, the log indicates that the keypress caused that script to load and run. Also, immediately after Kodi started running the script (which was never invoked?), your HTSP stream started dropping lots of packets, followed immediately by the VideoPlayer process exiting.

To me, that seems to be a direct link: Kodi says you pressed keys that launched this script, and right after that your TV stream has issues and closes.
Reply
#7
(2017-10-21, 01:33)rpcameron Wrote: Well, the log indicates that the keypress caused that script to load and run.

Sorry, I didn't look into that properly before. You appear to be right. I'll have to investigate what's causing that key combination to be triggered, as I'm pretty sure I'm not pressing it!

Thanks.
Reply
#8
Unfortunately, the script seems not to be the issue. This time the same stuttering and crash occurred, but there's no mention of the script in the log file. I also edit the contents of the script so it would just write to the log file, but it wasn't called in the end.

https://pastebin.com/N1rjdZY1

I found that another instance of Kodi, running on Windows and connected to the same Tvheadend backend, continued playing fine when the Ubuntu instance crashed.

I guess the next thing to try is a fresh user account on the Ubuntu machine.
Reply
#9
The errors are the same, basically. You are having issues with your TV stream. Your original debug log showed lots of dropped packets. This new one shows buffer and sync issues, likely stemming from more missing packets.

In short, there's an issue with your stream from TVH to Kodi. Is this a wired or wireless connection?

Also, please try with a clean user account. (Or at least a clean Kodi install instead of one with lots of plugins ... having to read through 2500 lines of a log just to get to where the issue might be is quite a pain for those trying to help.)
Reply
#10
I've captured a debug log of the issue using a clean Kodi configuration. The issue remains, with the same dropped packets showing up in the log: https://pastebin.com/YA5BUuFX.

The TVheadend server and Kodi client are actually on the same machine, and Kodi is configured with a loopback IP of 127.0.0.1 for communication with TVheadend. I'll try using the actual network interface's IP address instead, to eliminate issues with the loopback interface.

Weirdly, other computers can connect to the same backend without issues.
Reply
#11
A few more things I've discovered...
  1. When Kodi hangs it's impossible to connect to the server via SSH. The network seems to hang as well
  2. Connecting to Tvheadend from the Android client kicks the server out of this state, and Kodi will quit immediately (without prompting)
  3. Resetting Tvheadend's settings and re-configuring from scratch doesn't help
  4. The Tvheadend log shows the same dropped packets as 'continuity counter' errors, but no more useful information (log snippet here)
I'm going to set up two Kodi clients to connect to the same backend and log all three at the same time. Maybe this will show something up...
Reply
#12
I should have spotted this earlier, however Kodi seems to be leaking memory when playing live TV. After a couple of hours the Linux OOM killer steps in:

html:
[66145.313361] Out of memory: Kill process 4616 (kodi.bin) score 821 or sacrifice child
[66145.313505] Killed process 4616 (kodi.bin) total-vm:7238580kB, anon-rss:2581196kB, file-rss:0kB

Edit:
I've checked a fresh install of Ubuntu 16.04.3 on a different computer and found this also exhibits the memory leak, at a rate of about 40 MB per minute.

I can't work out if this is a problem generally with Kodi 17 on Ubuntu, or if there's something wrong with my Tvheadend configuration.
Reply

Logout Mark Read Team Forum Stats Members Help
Crash while playing live TV - Memory leak0