Bug #4867
Potential Memory Leak
0%
Description
I wonder if someone could help me suss out why TVHeadEnd uses an ever expanding amount of memory until it crashes.
First off, I should say I'm running linuxserver.io's docker container (with TVHeadEnd v4.3-943~g9b85e7b7c) as that could be relevant.
I run this excellent docker container on a Synology DS918+ (w/ 4GB Ram, upping this to 16GB tonight) but for the first time on Saturday, it crashed as it wanted more memory than my box had. I use Sat>IP as the source of the input signal (in cast that's relevant).
Here's what happens.
The box will start recording and the memory usage goes up by approximately 1.5MB every 2 seconds.
If the memory requirement goes beyond that available it crashes (OOM).
I'm really not sure why it's needing more memory for what should be a straightforward "receive over ip", "transfer to disk" manoeuvre. The CPU is always less than 10%, so I can only think caching. I don't think the disk i/o is a limiting factor as it's 4 x 3TB disks (Raid5) and in a "dd if=/dev/zero of=/tmp/test bs=1G" test, it completed it in just over a second.
I have played with the caching settings on TVHeadEnd under "Configuration, Recording, Recording Profile" and I'm currently on "System", but have also tried "Sync and Don't Keep", and "Don't Keep" to no avail.
Timeshift is currently enabled, but with this disabled it still displays the same symptoms.
The logs show NOTHING abnormal whatsoever and ZERO error messages related to this directly afaik.
Any ideas on tools I can run to work out why this is happening.
Thanks
:-)
dp
PS - I've posted a similar message in linuxserver.io's forums in case it's a Docker Image issue
History
Updated by David Pollard almost 7 years ago
With 16GB Ram, I caught the container using over 9GB ram last night and at that time, interacting with TVHeadEnd via the web interface resulted in the frontend (LibreElec (Kodi)) crashing. (adding in case this is relevant)
Happy to do any tests to nail this issue
Updated by David Pollard almost 7 years ago
Maybe my error thinking the memory usage was related to the inability to record from web interface. On low memory usage just now (in testing), a request to record from web interface results in a popup box in the web browser (entitled "DVR) with the message "Communication Failure".
Meanwhile the backend TVHeadEnd process crashes (and then restarts) with this message :-
2018-01-17 10:53:32.974 [ INFO] htsp: 192.168.1.16: Welcomed client software: Kodi Media Center (HTSPv29)
2018-01-17 10:53:32.975 [ INFO] htsp: 192.168.1.16 [ Kodi Media Center ]: Unauthorized access
2018-01-17 10:54:07.865 [ ALERT] CRASH: Signal: 11 in PRG: /usr/bin/tvheadend (4.3-943~g9b85e7b7c) [ff02558583846d5705f33bcf18cfda7f4b372c47] CWD: /run/s6/se
rvices/tvheadend
2018-01-17 10:54:07.865 [ ALERT] CRASH: Fault address 0 (Address not mapped)
2018-01-17 10:54:07.865 [ ALERT] CRASH: Loaded libraries: /usr/bin/tvheadend /usr/lib/libhdhomerun.so /lib/libssl.so.44 /lib/libcrypto.so.42 /lib/libz.so.1 /
usr/lib/libpcre2-8.so.0 /usr/lib/liburiparser.so.1 /usr/lib/libavfilter.so.6 /usr/lib/libavformat.so.57 /usr/lib/libavcodec.so.57 /usr/lib/libavutil.so.55 /li
b/ld-musl-x86_64.so.1 /usr/lib/libavresample.so.3 /usr/lib/libswscale.so.4 /usr/lib/libpostproc.so.54 /usr/lib/libswresample.so.2 /usr/lib/libva.so.1 /usr/lib
/librtmp.so.1 /usr/lib/libgnutls.so.30 /usr/lib/libbz2.so.1 /usr/lib/libxvidcore.so.4 /usr/lib/libx265.so.130 /usr/lib/libx264.so.148 /usr/lib/libvpx.so.4 /us
r/lib/libvorbisenc.so.2 /usr/lib/libvorbis.so.0 /usr/lib/libtheoraenc.so.1 /usr/lib/libtheoradec.so.1 /usr/lib/libopus.so.0 /usr/lib/libmp3lame.so.0 /usr/lib/
libvdpau.so.1 /usr/lib/libX11.so.6 /usr/lib/libva-x11.so.1 /usr/lib/libva-drm.so.1 /usr/lib/libp11-kit.so.0 /usr/lib/libunistring.so.2 /usr/lib/libtasn1.so.6
/usr/lib/libnettle.so.6 /usr/lib/libhogweed.so.4 /usr/lib/libgmp.so.10 /usr/lib/libstdc++.so.6 /usr/lib/libog
2018-01-17 10:54:07.865 [ ALERT] CRASH: Register dump [23]: fefefefefefefeff00005625f6f1cff00000000000000001000000000000000100005625f6feb42000005625fa0f14200
0005625f864b791000000000000000000000000000000008080808080808080000000000000000000005625fb9193c000000000000000000000000000000000000000000000000000007f9c3b64002
800007f9c4c58f80e000000000001024600000000000000330000000000000004000000000000000efffffffc7ffbba130000000000000000
Updated by Jaroslav Kysela almost 7 years ago
As I wrote, try latest. There are many code changes those days and I think that some issues (including your DVR problem) is already resolved. Thanks.