OSMC, RPi2 - continuous out-of-memory problem

I would say use it, if it starts eating memory then we know,

Hi,

Your last massage I could not read yesterday because of I went to bed already…so I left the Pi 2 in idle.

The sate is the system now:

osmc@osmc:~$ ps aux --sort -rss | head -n 20

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND                    
osmc       277  5.4 23.4 602952 176064 ?       Sl   szept02 145:29 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd

osmc       309  0.1  3.5 266392 26548 ?        Ssl  szept02   3:41 /usr/local/bin/tvheadend -f -p /run/tvheadend.pid -C -u osmc -g video

root       320  0.7  1.0  73944  8128 ?        Sl   szept02  19:45 /opt/bin/mediasrv -d --pluginpath=/opt/bin

root       299  0.0  0.6  34900  4532 ?        Ssl  szept02   0:00 /usr/lib/policykit-1/polkitd --no-debug

root       283  0.0  0.5  16392  4480 ?        Ssl  szept02   0:00 /usr/lib/udisks/udisks-daemon --no-debug          
root      2160  0.0  0.5  10852  4464 ?        Ss   19:34   0:00 sshd: osmc [priv]                                   
root       295  0.0  0.5   5764  4332 ?        Ss   szept02   0:07 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

root       235  0.0  0.5   6512  4044 ?        Ss   szept02   0:03 /usr/sbin/connmand -n --nodnsproxy --config=/etc/connman.conf

root       242  0.0  0.5   6948  3856 ?        Ss   szept02   0:00 /usr/sbin/sshd -D                                             
root       107  0.0  0.4   8756  3540 ?        Ss   szept02   0:04 /lib/systemd/systemd-journald                                 
root         1  0.0  0.4  23196  3344 ?        Ss   szept02   0:08 /sbin/init                                                    
osmc      2167  0.0  0.4  10852  3316 ?        S    19:34   0:00 sshd: osmc@pts/0                                                                                
ntp        545  0.0  0.4   5292  3264 ?        Ss   szept02   0:24 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 106:110                                             
osmc      2168  0.0  0.4   5204  3152 pts/0    Ss   19:34   0:00 -bash                                                                                           
osmc      2163  0.0  0.3   4332  2704 ?        Ss   19:34   0:00 /lib/systemd/systemd --user                                                                     
osmc       280  0.0  0.3   5580  2684 ?        Ss   szept02   0:00 /usr/bin/udisks-glue --foreground                                                             
message+   232  0.0  0.3   4984  2644 ?        Ss   szept02   0:19 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation    
root       135  0.0  0.3  11056  2540 ?        Ss   szept02   0:00 /lib/systemd/systemd-udevd

root       276  0.0  0.3   5748  2460 ?        S    szept02   0:00 sudo -u osmc /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd

osmc@osmc:~$ 

And some other values from last night around the TVHeadend HTSP client installation:

Before the plugin installation

osmc@osmc:~$ ps aux --sort -rss | head -n 20
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND                          
osmc       277  5.2 16.7 485888 126132 ?       Sl   szept02  76:06 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd

After the plugin installation

osmc@osmc:~$ ps aux --sort -rss | head -n 20
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND                   
osmc       277  5.3 17.9 534524 134664 ?       Sl   szept02  77:03 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd  

10 seconds after with the enabled (and configured) plugin

osmc@osmc:~$ ps aux --sort -rss | head -n 20
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
osmc       277  5.3 18.0 535548 135920 ?       Sl   szept02  77:15 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd

After 15 minutes in idle state with the enabled plugin

osmc@osmc:~$ ps aux --sort -rss | head -n 20
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
osmc       277  5.3 19.4 569340 146344 ?       Sl   szept02  78:20 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd7

I wait for your expert opinion:

  • the system state is still normal (acceptable the memory consumption in idle state) or not?
  • if your answer yes can I continue the test with live TV watching?

Thanks in advance,

On today morning the result is as I experienced earlier.

I started the live TV watching last night 23:11:04 (according to journalctl) and the “Kodi.bin” was killed by the kernel at 03:14:12 (after 5 hours of “real” operation).

Is there any idea from developers how can I identify and solve this symptom?

Thanks in advance,

What pvr are you using? Have you played with cache settings at all? Do you have an advancedsettings file in userdata?

EDIT: Looking back I can see it’s TVHeadend, is the server running on the Pi as well?

Hi,

I would like to use the HTSP TVheadend server and client.

Have not. I do not use any network share, local drive or something like.
My configuration is the next:

  • RPi 2 with 2,1A power supply and a HDMI-VGA converter,
  • USB WiFi connection for net (with Realtek chipset)
  • USB DVB-T tuner (Sundtek) with its remote controll,
  • 64GB microSD card in RPi 2,
  • and an old HP desktop LCD monitor (1950)
    Nothing more (NFS, Samba, local USB drive, UPNP, without any video and audio library and other unnecessary thing…)!!!

I do not know - if I have got this came with the OSMC distribution, I did not write that file manually.

Yes, the server runs on the same RPi 2 as the Kodi.
(I have tried a lot of versions of the TVHeadend server and in all cases the “Kodi.bin” memory consumption was increased till the kernel killed it, so i do not think that would be any relationship between the TVHeadend server version and the problem - more exactly I did not find yet!)

Have you (or other developer) ever watched live TV for 5 or 6 hours or more?

What is your opinion how can I isolate and solve this problem?

And one more question: are you sure the memory consumption problem is just a particular symptom (especially is mine)?

Because of if the Kodi does not run the system tries to start (or restart) it.

Therefore the user leaves the system in idle state at the home screen (for example just the TV or monitor switched off) and the next time the user finds the home screen again (when switches on the TV or monitor again) - the user thinks nothing happened (of course this is absolute normal).

What do you think how many user does check the journalctl what and how happened from the last time of usage?

Without this you are not sure was or was not a Kodi restart…

I’m not too familiar with TVHeadend, is there a cache setting in the PVR addon? It sounds like the video is being cached until memory runs out. If you stop live tv before the OOM does the memory stay high or does it drop to normal levels?

Hi, first is the answers your questions:

If I am right there is not.

Before the last upgrade I have not experienced this, the memory consumption is always grows.

I upgraded the system on last night.

Some new (bad and good) experience with the new version:

  1. The initial memory reservation is significantly lower than in the previous versions were (around 78000 KiB in my configuration) => :star::star::star::star::star:

  2. With the default OMSC skin the live TV watching is impossible because of within a minute the picture is frozen, but everything is working properly, so if you restart the actual channel (or other one) the watching again works approximately for one minute.

  3. Due to that in the previous point i wrote I had to change the skin to “Confluance”. With this skin the live TV watching works properly for long time. What is your opinion about this? Could you check this very interesting experience please!

  4. The memory allocation in this version more or less properly compared to the previous versions. I gave experienced what you asked: I had a case when after a channel change (stop the actual and start a new one) the allocated memory is (significantly: from around 330000 KiB to 220000 KiB) reduced. The second: the memory allocation was not increasing continuously - just at the channel change. Between the channel change the memory allocation is (almost) constant!!! => :star::star::star::star::star:

  5. I have experienced one more interesting thing: when I switch off the monitor (during the live TV watching) the picture is being frozen. The symptom does not come forward immediately but if you leave the system in that state for some hours it will come forward (when you switch on the display again you might find a frozen picture). The situation is same as I wrote in the 2. point - so nothing is “dead” just the displaying is frozen, if I restart the actual channel or start a new one everything will work properly again. I you do not switch the monitor off the symptom does not come forward.
    Is it possible that is there any relationship between the monitor off state and the displaying frozen (or this issue again especially is mine)?

Thanks in advance,

So are you saying the OOM isn’t happening any more? I really don’t know where to go from here, obviously others are running TVH and no one else is experiencing OOM problems. This leads me to a problem with one of your settings either in the frontend or backend causing excessive cache/buffer

I think there is really an memory problem:
the memory is 100% in use

Is this the solution?
If you’re using the sdhost driver, switch to the mmc driver and see if the problem goes away.

Today i have no time to test it, but I think tomorrow …

We don’t use the sdhost driver by default, so no it won’t be that. I don’t see how sdhost would cause kodi to have excessive memory use anyway - completely unrelated.

Hi,

Good news: after the last two upgrade, the state of the issue is almost normalized.

Last evening I have upgraded (again) the system and started testing.

The initial memory allocation was around 78000 KiB in idle state.

When I was starting the the live TV watching the memory allocation grown to around 95000 KiB.

Before I went to my bed the memory allocation was around 99000 KiB.

Today evening - after approximately one day (23 h 34 min continuous operation) - the memory allocation is around 101000 KiB.

I think this is significantly better than ever!!!

:question: I have got only one question: who and what corrected? :question: