rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 8:58 am

tl;dr

Chromium eats the whole ram of a 2 GB Pi 4 while playing online streaming video in one single window (no other Chromium windows, just one) after a few hours. Before the system becomes unresponsive, streaming from Netflix or Disney+ works totally flawless.

Setup:

-Pi 4 2 GB
-Chromium with DRM libs for Netflix, Disney+ (Widevine)
- Standard Raspbian/Raspberry Pi OS with all updates
- No other modifications or odd settings, it's pretty much a fresh and default installation except for the Widevine DRM components
- One week old Sandisk Extreme/Ultra whatever quality microSD card

Issue:


So, here's the thing. I've been watching a two hours movie on Netflix without any issues. No visual tearing, stuttering or anything, just flawless. I then was watching something on Disney+, also no issues or anything and all of a sudden, the picture freezes.

I thought the Pi 4 might be overheating, but it's in a metal case made from one block of metal and a quick SSH into it shows ~52 degrees, which is totally fine, so temperature is ruled out. I also had a look if some other task would "block" the cpu, but that's also not the case, as cpu usage was low.

The only thing I found is, that Chromium eats ALL THE RAM using one window playing video after a while. Initially, about 400 mb of ram are used and once the Chromium process allocated about 1700 mb, the system starts swapping to microSD card and starts to become unresponsive.

So the question I have is, how can I prevent Chromium from gobbling all ram with one single browser window? I mean, how does this even happen? Streaming is grabbing small parts of a file and rendering it locally and if rendered, dropping those parts of the file and grabbing the next part to render it and so on. It does not make sense. When the Pi 4 becomes unresponsive, I can SSH into it to display the temperature, but I can't shut it down properly, as it would not respond to the shutdown command. After a reboot, I can continue streaming video for three or four hours, until the Chromium process again uses all ram and the system becomes unresponsive again.

Anyone got an idea what's happening? Why would Chrome grow bigger and bigger with ram usage when only having one window open and playing streaming video?

Additional info:

The memory overflow issue also happens when watching video streams without DRM, so that does not seem to be the issue.




Here's the memory usage when the Pi 4 became unresponsive:


"%Cpu(s): 0,4 us, 12,6 sy, 0,0 ni, 13,1 id, 73,8 wa, 0,0 hi, 0,0 si, 0,0 st
MiB Mem : 1887,9 total, 36,0 free, 1694,9 used, 157,0 buff/cache
MiB Swap: 100,0 total, 0,0 free, 100,0 used. 8,6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3496 pi 20 0 2086392 1,4g 75780 D 4,2 78,2 12:21.84 chromium-+
3579 pi 20 0 301572 44076 3752 D 1,2 2,3 26:51.12 chromium-+
3129 pi 20 0 542948 38432 840 D 3,4 2,0 1:12.14 chromium-+
3184 pi 20 0 338444 30432 7456 D 4,9 1,6 6:13.99 chromium-+
3293 pi 20 0 356348 30116 1672 S 0,7 1,6 0:09.45 chromium-+
565 root 20 0 138684 17996 1232 D 1,2 0,9 3:38.39 Xorg
3187 pi 20 0 256592 11732 124 S 0,0 0,6 1:29.12 chromium-+
3396 pi 20 0 252188 11368 60 S 0,0 0,6 0:00.00 chromium-+
3508 pi 20 0 304532 9492 272 S 0,0 0,5 0:00.11 chromium-+
3152 pi 20 0 206864 6720 60 S 0,0 0,3 0:00.07 chromium-+
3150 pi 20 0 206864 6616 0 S 0,0 0,3 0:00.13 chromium-+
842 pi 20 0 150264 6216 368 S 0,2 0,3 0:08.76 lxpanel
3585 pi 20 0 218392 6176 32 S 0,0 0,3 0:31.54 chromium-+
477 root 20 0 38720 4736 0 S 0,0 0,2 0:00.36 unattende+
493 root 20 0 29476 4152 0 S 0,0 0,2 0:02.33 vncserver+
843 pi 20 0 83816 4000 84 S 0,0 0,2 0:00.86 pcmanfm
837 pi 20 0 63060 2536 84 S 0,0 0,1 0:00.42 openbox"

Thanks for your ideas/insights. I have absolutely no idea how to solve this.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 30111
Joined: Sat Jul 30, 2011 7:41 pm

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 9:34 am

When did you last do a

Code: Select all

sudp apt update
sudo apt full-upgrade
There was a bug fix for video freezes at the beginning of this week, Tuesday I think.

However, I'm not convinced that it fixes what you are seeing, but worth a go.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 9:46 am

jamesh wrote:
Thu Jun 04, 2020 9:34 am
When did you last do a

Code: Select all

sudp apt update
sudo apt full-upgrade
There was a bug fix for video freezes at the beginning of this week, Tuesday I think.

However, I'm not convinced that it fixes what you are seeing, but worth a go.
I got a cronjob running, updates every morning at four and reboots itself at five. It's a Pi which I experiment with, so the daily auto-update in the night is fine with me.

The "freeze" occurs at the very moment, when the Pi starts swapping to the microSD card due to Chromium eating up all ram and it only happens after about three to four hours of streaming. Once I reboot the system, I can continue streaming video without issues. System is around 50 degrees C all the time.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 30111
Joined: Sat Jul 30, 2011 7:41 pm

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 10:39 am

OK, so we need to be able to reproduce this without needing access to things we don't necessarily have (e.g. Disney+)

Do you have any examples that don't require a subscription service to replicate?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 11:21 am

jamesh wrote:
Thu Jun 04, 2020 10:39 am
OK, so we need to be able to reproduce this without needing access to things we don't necessarily have (e.g. Disney+)

Do you have any examples that don't require a subscription service to replicate?
I will try to replicate the issue with:

a) subscription free service: Youtube
b) subscription free service: some streaming website (Note: I don't condone streaming without paying. I got Prime, Netflix and D+ so I don't need "not so legal" websites)

I'll post a follow up comment once the Pi 4 got stuck again. This will probably take three to four hours if the behaviour is the same like when playing Netflix or D+. Thanks!

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 11:39 am

Initial memory usage after reboot and without open apps, just displaying desktop:

Code: Select all

top - 13:24:37 up 2 min,  1 user,  load average: 0,59, 0,44, 0,18
Tasks: 149 total,   1 running, 148 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0,9 us,  0,2 sy,  0,0 ni, 98,8 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :   1887,9 total,   1281,5 free,    143,3 used,    463,1 buff/cache
MiB Swap:    100,0 total,    100,0 free,      0,0 used.   1623,5 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
  562 root      20   0  137492  49376  33268 S   1,3   2,6   0:04.21 Xorg       
  956 pi        20   0  167904  49020  38380 S   0,7   2,5   0:01.63 lxterminal 
  803 pi        20   0  150060  29048  23528 S   0,0   1,5   0:01.10 lxpanel    
  804 pi        20   0   83740  22328  18436 S   0,0   1,2   0:00.72 pcmanfm    
  462 root      20   0   33588  18392  12908 S   1,7   1,0   0:03.29 vncserver+ 
  481 root      20   0   38720  15808  10672 S   0,0   0,8   0:00.27 unattende+ 
  799 pi        20   0   63204  15296  13052 S   0,7   0,8   0:00.24 openbox    
  955 pi        20   0   32192  14248  12716 S   0,0   0,7   0:00.05 vncserver+ 
 1135 root      20   0   84852  13404  12100 S   0,0   0,7   0:00.10 packageki+ 
  738 pi        20   0   56860  13228  11912 S   0,0   0,7   0:00.16 lxsession  
  924 pi        20   0   32068  12636  10476 S   0,0   0,7   0:00.28 vncserver+ 
  802 pi        20   0   47684  11160  10132 S   0,0   0,6   0:00.04 lxpolkit   
  835 pi        20   0   79856  10668   9444 S   0,0   0,6   0:00.10 gvfs-udis+ 
  367 root      20   0   65208  10600   8824 S   0,0   0,5   0:00.26 udisksd    
  868 pi        20   0   55572   8408   7560 S   0,0   0,4   0:00.06 gvfsd-tra+ 
    1 root      20   0   33772   8164   6524 S   0,0   0,4   0:03.16 systemd    
  573 root      20   0   15080   7912   7436 S   0,7   0,4   0:00.57 vncagent   
I also have manually applied once more the update process to make 100% sure, the system is 100% at current release version.

I started the video playback at 12:30 (CET) using Chromium (Default Chromium without Videwine DRM modules) playing https://www.youtube.com/watch?v=AIyonw6LEOs at "auto" resolution. It's a 10 hours video from SpaceX.

Memory usage after opening one Chromium window, playing the Youtube link from above:

Code: Select all

top - 13:30:31 up 8 min,  1 user,  load average: 2,34, 1,54, 0,71
Tasks: 155 total,   3 running, 152 sleeping,   0 stopped,   0 zombie
%Cpu(s): 29,0 us,  6,3 sy,  0,0 ni, 63,6 id,  0,0 wa,  0,0 hi,  1,2 si,  0,0 st
MiB Mem :   1887,9 total,    826,6 free,    350,9 used,    710,4 buff/cache
MiB Swap:    100,0 total,    100,0 free,      0,0 used.   1359,4 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
 2473 pi        20   0  504792 158212  79672 S  23,8   8,2   0:30.33 chromium-+ 
 2323 pi        20   0  490048 125392  84712 S   3,0   6,5   0:08.76 chromium-+ 
 2475 pi        20   0  352708  84744  58608 S   0,0   4,4   0:02.23 chromium-+ 
 2367 pi        20   0  338956  81296  60336 S  21,1   4,2   0:18.56 chromium-+ 
 2744 pi        20   0  331188  69108  53196 S   1,7   3,6   0:00.60 chromium-+ 
 2372 pi        20   0  248248  50416  40188 S   6,3   2,6   0:02.02 chromium-+ 
  562 root      20   0  137804  49668  33276 S  36,6   2,6   1:16.43 Xorg       
  956 pi        20   0  167904  49024  38380 S   0,7   2,5   0:01.76 lxterminal 
 2604 pi        20   0  295828  46052  36916 S   0,0   2,4   0:00.11 chromium-+ 
 2344 pi        20   0  206864  40376  33760 S   0,0   2,1   0:00.12 chromium-+ 
 2701 pi        20   0  218500  38724  32660 S   1,7   2,0   0:01.53 chromium-+ 
  803 pi        20   0  150196  29240  23528 S   0,0   1,5   0:01.91 lxpanel    
  804 pi        20   0   83740  22328  18436 S   0,0   1,2   0:00.76 pcmanfm    
  462 root      20   0   33848  18460  12908 R  49,8   1,0   1:49.59 vncserver+ 
  481 root      20   0   38720  15808  10672 S   0,0   0,8   0:00.27 unattende+ 
  799 pi        20   0   63556  15608  13088 S   0,0   0,8   0:00.35 openbox    
 2554 pi        20   0  252168  14836   3536 S   0,0   0,8   0:00.00 chromium-+
Now I will let the Pi 4 sit there and play the video for some hours and see, if Chromium starts allocating all ram again. If not, I'll have to do the following tests:

- Default Chromium (unmodified) playing video from some other website
- Modified Chromium (Videwine DRM) playing video from Youtube
- Modified Chromium (Videwine DRM) playing video from some other website

I'll see how it goes, will report here in this thread.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 30111
Joined: Sat Jul 30, 2011 7:41 pm

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 12:22 pm

rpi4.local wrote:
Thu Jun 04, 2020 11:39 am
Initial memory usage after reboot and without open apps, just displaying desktop:

Code: Select all

top - 13:24:37 up 2 min,  1 user,  load average: 0,59, 0,44, 0,18
Tasks: 149 total,   1 running, 148 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0,9 us,  0,2 sy,  0,0 ni, 98,8 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :   1887,9 total,   1281,5 free,    143,3 used,    463,1 buff/cache
MiB Swap:    100,0 total,    100,0 free,      0,0 used.   1623,5 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
  562 root      20   0  137492  49376  33268 S   1,3   2,6   0:04.21 Xorg       
  956 pi        20   0  167904  49020  38380 S   0,7   2,5   0:01.63 lxterminal 
  803 pi        20   0  150060  29048  23528 S   0,0   1,5   0:01.10 lxpanel    
  804 pi        20   0   83740  22328  18436 S   0,0   1,2   0:00.72 pcmanfm    
  462 root      20   0   33588  18392  12908 S   1,7   1,0   0:03.29 vncserver+ 
  481 root      20   0   38720  15808  10672 S   0,0   0,8   0:00.27 unattende+ 
  799 pi        20   0   63204  15296  13052 S   0,7   0,8   0:00.24 openbox    
  955 pi        20   0   32192  14248  12716 S   0,0   0,7   0:00.05 vncserver+ 
 1135 root      20   0   84852  13404  12100 S   0,0   0,7   0:00.10 packageki+ 
  738 pi        20   0   56860  13228  11912 S   0,0   0,7   0:00.16 lxsession  
  924 pi        20   0   32068  12636  10476 S   0,0   0,7   0:00.28 vncserver+ 
  802 pi        20   0   47684  11160  10132 S   0,0   0,6   0:00.04 lxpolkit   
  835 pi        20   0   79856  10668   9444 S   0,0   0,6   0:00.10 gvfs-udis+ 
  367 root      20   0   65208  10600   8824 S   0,0   0,5   0:00.26 udisksd    
  868 pi        20   0   55572   8408   7560 S   0,0   0,4   0:00.06 gvfsd-tra+ 
    1 root      20   0   33772   8164   6524 S   0,0   0,4   0:03.16 systemd    
  573 root      20   0   15080   7912   7436 S   0,7   0,4   0:00.57 vncagent   
I also have manually applied once more the update process to make 100% sure, the system is 100% at current release version.

I started the video playback at 12:30 (CET) using Chromium (Default Chromium without Videwine DRM modules) playing https://www.youtube.com/watch?v=AIyonw6LEOs at "auto" resolution. It's a 10 hours video from SpaceX.

Memory usage after opening one Chromium window, playing the Youtube link from above:

Code: Select all

top - 13:30:31 up 8 min,  1 user,  load average: 2,34, 1,54, 0,71
Tasks: 155 total,   3 running, 152 sleeping,   0 stopped,   0 zombie
%Cpu(s): 29,0 us,  6,3 sy,  0,0 ni, 63,6 id,  0,0 wa,  0,0 hi,  1,2 si,  0,0 st
MiB Mem :   1887,9 total,    826,6 free,    350,9 used,    710,4 buff/cache
MiB Swap:    100,0 total,    100,0 free,      0,0 used.   1359,4 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
 2473 pi        20   0  504792 158212  79672 S  23,8   8,2   0:30.33 chromium-+ 
 2323 pi        20   0  490048 125392  84712 S   3,0   6,5   0:08.76 chromium-+ 
 2475 pi        20   0  352708  84744  58608 S   0,0   4,4   0:02.23 chromium-+ 
 2367 pi        20   0  338956  81296  60336 S  21,1   4,2   0:18.56 chromium-+ 
 2744 pi        20   0  331188  69108  53196 S   1,7   3,6   0:00.60 chromium-+ 
 2372 pi        20   0  248248  50416  40188 S   6,3   2,6   0:02.02 chromium-+ 
  562 root      20   0  137804  49668  33276 S  36,6   2,6   1:16.43 Xorg       
  956 pi        20   0  167904  49024  38380 S   0,7   2,5   0:01.76 lxterminal 
 2604 pi        20   0  295828  46052  36916 S   0,0   2,4   0:00.11 chromium-+ 
 2344 pi        20   0  206864  40376  33760 S   0,0   2,1   0:00.12 chromium-+ 
 2701 pi        20   0  218500  38724  32660 S   1,7   2,0   0:01.53 chromium-+ 
  803 pi        20   0  150196  29240  23528 S   0,0   1,5   0:01.91 lxpanel    
  804 pi        20   0   83740  22328  18436 S   0,0   1,2   0:00.76 pcmanfm    
  462 root      20   0   33848  18460  12908 R  49,8   1,0   1:49.59 vncserver+ 
  481 root      20   0   38720  15808  10672 S   0,0   0,8   0:00.27 unattende+ 
  799 pi        20   0   63556  15608  13088 S   0,0   0,8   0:00.35 openbox    
 2554 pi        20   0  252168  14836   3536 S   0,0   0,8   0:00.00 chromium-+
Now I will let the Pi 4 sit there and play the video for some hours and see, if Chromium starts allocating all ram again. If not, I'll have to do the following tests:

- Default Chromium (unmodified) playing video from some other website
- Modified Chromium (Videwine DRM) playing video from Youtube
- Modified Chromium (Videwine DRM) playing video from some other website

I'll see how it goes, will report here in this thread.
Great, thanks very much for this testing!

(And we use that SpaceX stream as well - lots of space fans here at Pi!)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 1:01 pm

jamesh wrote:
Thu Jun 04, 2020 12:22 pm

Great, thanks very much for this testing!

(And we use that SpaceX stream as well - lots of space fans here at Pi!)
Do people exist who don't feel love for SpaceX? :D

I'll do the other tests but this might take a while, as I only have one Pi 4 for testing, each test setup takes at least 4 hours and I have to run each test sequentially, so might be a day or two for reproducible results. Will keep you posted.

User avatar
Botspot
Posts: 1778
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 3:05 pm

rpi4.local wrote:
Thu Jun 04, 2020 1:01 pm
I'll do the other tests but this might take a while, as I only have one Pi 4 for testing, each test setup takes at least 4 hours and I have to run each test sequentially, so might be a day or two for reproducible results. Will keep you posted.
To speed up your tests, consider adding a RAM monitor to your taskbar, and see if the graph gradually increases over time.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 3:24 pm

Botspot wrote:
Thu Jun 04, 2020 3:05 pm
rpi4.local wrote:
Thu Jun 04, 2020 1:01 pm
I'll do the other tests but this might take a while, as I only have one Pi 4 for testing, each test setup takes at least 4 hours and I have to run each test sequentially, so might be a day or two for reproducible results. Will keep you posted.
To speed up your tests, consider adding a RAM monitor to your taskbar, and see if the graph gradually increases over time.
I don't think I can speed up testing, as the "Raspberry becomes unresponsive/starts swapping" event starts after three or four hours of video streaming.

Result #1:
Default Chromium streaming Youtube for 4 hours.

At the start of streaming:
MiB Mem : 1887,9 total, 826,6 free, 350,9 used, 710,4 buff/cache

After four hours:
MiB Mem : 1887,9 total, 378,2 free, 605,3 used, 904,4 buff/cache

Conclusion: No memory leak/overflow

Will start next test now.

User avatar
Botspot
Posts: 1778
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 3:31 pm

rpi4.local wrote:
Thu Jun 04, 2020 3:24 pm
Result #1:
Default Chromium streaming Youtube for 4 hours.

At the start of streaming:
MiB Mem : 1887,9 total, 826,6 free, 350,9 used, 710,4 buff/cache

After four hours:
MiB Mem : 1887,9 total, 378,2 free, 605,3 used, 904,4 buff/cache

Conclusion: No memory leak/overflow
"no memory leak"? It looks to me like Chromium was gradually using more and more. :? If you kept it running, maybe it would have run out.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 7:36 pm

Botspot wrote:
Thu Jun 04, 2020 3:31 pm
rpi4.local wrote:
Thu Jun 04, 2020 3:24 pm
Result #1:
Default Chromium streaming Youtube for 4 hours.

At the start of streaming:
MiB Mem : 1887,9 total, 826,6 free, 350,9 used, 710,4 buff/cache

After four hours:
MiB Mem : 1887,9 total, 378,2 free, 605,3 used, 904,4 buff/cache

Conclusion: No memory leak/overflow
"no memory leak"? It looks to me like Chromium was gradually using more and more. :? If you kept it running, maybe it would have run out.
My observations show, that the memory usage stays pretty much constant after a while in test #1 and 2#. To confirm this, I will execute a 24 hours streaming test after I have completed test 3# and 4#. Test 3# and 4# will include the modified Chromium (added Widevine DRM) and streaming from Netflix and Disney+.

Result #2:
Default Chromium streaming two movies at two hours each. Browser remained open while selecting the second movie.

At the start of streaming:
MiB Mem : 1887,9 total, 945,9 free, 391,2 used, 550,7 buff/cache

After four hours/end of second movie:
MiB Mem : 1887,9 total, 787,9 free, 489,0 used, 611,0 buff/cache

Conclusion: No memory leak/overflow. All looking good.

I now have the suspicion, that the integration of the Widevine DRM into the modified version of Chromium might cause the extremely high memory usage. Will deliver results for test #3 and #4 in a follow up posting. From my perspective I'd say, that streaming which does not need DRM components does not cause high memory usage with default Chromium.

rpi4.local
Posts: 25
Joined: Thu Jun 04, 2020 8:20 am

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Jun 04, 2020 9:05 pm

"top - 22:59:03 up 1:15, 1 user, load average: 3,06, 3,28, 3,46
Tasks: 152 total, 2 running, 150 sleeping, 0 stopped, 0 zombie
%Cpu(s): 51,6 us, 9,7 sy, 0,0 ni, 35,2 id, 1,7 wa, 0,0 hi, 1,8 si, 0,0 st
MiB Mem : 1887,9 total, 276,4 free, 1363,0 used, 248,5 buff/cache
MiB Swap: 100,0 total, 30,5 free, 69,5 used. 348,9 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1827 pi 20 0 1617560 1,1g 71548 S 25,9 59,7 11:13.51 chromium-+
962 pi 20 0 576984 86284 39572 S 2,7 4,5 2:17.62 chromium-+
1859 pi 20 0 304116 65032 22152 S 85,7 3,4 26:54.92 chromium-+
1158 pi 20 0 363708 59160 27792 S 0,3 3,1 0:23.80 chromium-+
1006 pi 20 0 343320 51464 29612 S 19,6 2,7 13:45.27 chromium-+
1010 pi 20 0 266588 28124 16304 S 7,6 1,5 6:11.67 chromium-+
564 root 20 0 137588 27756 11592 S 16,6 1,4 16:30.25 Xorg
1413 pi 20 0 85708 14696 9492 S 1,0 0,8 0:00.84 lxterminal
487 root 20 0 34364 14248 8280 S 74,8 0,7 38:22.89 vncserver+
1430 pi 20 0 218392 12620 6452 S 1,3 0,7 1:08.09 chromium-+
802 pi 20 0 150128 12332 9820 S 0,0 0,6 0:03.19 lxpanel
1360 pi 20 0 304532 12284 3052 S 0,0 0,6 0:00.12 chromium-+
1105 pi 20 0 252172 11700 404 S 0,0 0,6 0:00.00 chromium-+
985 pi 20 0 206864 9000 2340 S 0,0 0,5 0:00.07 chromium-+
804 pi 20 0 83736 6832 5412 S 0,0 0,4 0:00.72 pcmanfm
983 pi 20 0 206864 6712 96 S 0,0 0,3 0:00.17 chromium-+
955 pi 20 0 32196 5972 4408 S 0,0 0,3 0:00.07 vncserver+ "

Result #3

Chromium with DRM and Disney+ streaming.

After a short while of streaming DRM protected content, about two hours, memory usage of Chromium goes way up. If I would have let the stream continue, memory would be used 100%, Raspberry would start swapping to sd card and become unresponsive again. So the error is 100% confirmed.

Conclusion: DRM free streaming in default Chromium works without issues and this thread can be closed as I have determined the source for error.

To do: Find out, why usage of Widevine in Chromium does cause a memory leak. If have a solution to this issue, I'll post it here.

amanzi
Posts: 1
Joined: Thu Mar 04, 2021 5:51 pm

Re: Video streaming: Memory overflow in Chromium after some hours

Thu Mar 04, 2021 6:14 pm

Hello

I experience similar issues on a Raspberry Pi 4 2G Rev 1.1 both with Raspberry Pi OS and with other OS e.g. Twister OS.
Regardless which operating system running, the memory overflows when watching DRM videos using widevine in Chromium.

Usually the pi freezes after 20-25 minutes of watching. Restarting the Pi (power off/on) is the only possibilty to get access again. After freezing it's not responding to SSH.
Right now, I'm protocolling memory and cpu usage as well as cpu temp using SSH to get more information. It seems that the freeze occurs as soon as the swap is full while there's still 100MB free on memory.

The Pi is connected to a TV 1920 1080 @60hz and ethernet.

Apart from the fact that Twister OS is not the best system if you experience memory issues, the error seems to be identical to Raspberry Pi OS.

Any solutions so far from last year?
Regards
Last edited by amanzi on Thu Mar 04, 2021 7:40 pm, edited 1 time in total.

renice123
Posts: 354
Joined: Tue Oct 15, 2019 3:56 pm

Re: Video streaming: Memory overflow in Chromium after some hours

Fri Mar 05, 2021 7:07 am

Several years ago I ran into this and other problems with Linux browsers on Arm
(Apparently, on computers with Intel processors, this problem is less relevant - I could not repeat the constantly occurring Arm error on machines with Intel processors). Also, as I think, numerous problems arise due to the fact that browsers use the same "engine" - for example, luakit will not hang where Chromium or Firefox (using a well-known "engine") hangs.
I minimized the most annoying errors on my Rpi by disabling the video acceleration drivers both in config.txt and at system boot. As soon as I turned off these drivers, Linux stopped freezing catastrophically often.
However, other problems arose, namely, the OS stopped working in the console mode - at the moment of switching from the graphics mode to the console, the OS hung tightly.
Fortunately, these freezes are easy to predict and just as easy to repeat: they occur after browsing sites with a lot of flash, javascript AJAX and other "trendy" innovations. So, in my case, if I go to a site with a lot of videos that work with loading content, then almost always after some time I will get problems in the OS at the time of scrolling the page or trying to enable video "rewind". If the acceleration drivers are disabled, then the hang will not be so catastrophic (the system will at least flush the file buffer to disk).
I am almost sure that it is impossible to solve these problems "quickly", it even seems to me that these problems arise due to the peculiarities of computer architecture and the unbridled desire of software developers to introduce hardware acceleration.
PS I recently wrote a C program using framebuffer. Everything worked like clockwork on the Intel processor, but as soon as I switched to Rpi, the OS started to freeze.
From this I conclude that there are features of the graphics frame buffer that cause the Rpi catastrophe. The "freezes" were very similar to those caused by Chromium =)

Return to “Troubleshooting”