docker-firefox
docker-firefox copied to clipboard
High RAM Consumption
I am using the default docker command which is found on the repo. However, it is using all of the RAM on my VPS. I have 10Gb of RAM on my server and the app is using all of it. Why?
How do you get the amount of consumed memory ? How many tabs do you have open in Firefox ?
I got it from the docker stats firefox
Here is it : 4.508GiB / 9.313GiB
And I have just one tab open(google.com).
I have exactly the same problem running 1 tab (home assistant). My host (htop) and docker stat say it uses 5GiB. CPU is also high, it uses 50-100% of a J5005 core when one client are just displaying the tab. Does not feel like it is reasonable.
When I am running firefox on my ordinary computer having about 20 tabs open including home assistant, it uses 800 MiB RAM, CPU 0-5% (Ryzen 5 so maybe not that comparable).
EDIT: The container had run for about 1-2 weeks when it had the high RAM usage. When I restart the container and the tab, it uses about 200MiB RAM. I guess it accumulates over time.
Thanks for the details. If you reproduce again, could you run:
docker exec <container name> top -n1
Also, do you have the same behaviour if another page other than home assistant is opened ?
Below is the stats for my firefox container which has been running for about a week without using it (never browsed to it):
docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
1cff4aa70a15 firefox 1.08% 827.2MiB / 15.3GiB 5.28% 134MB / 42MB 427MB / 3.42MB 119
docker exec firefox top -n1
Mem: 15714868K used, 324076K free, 385596K shrd, 205760K buff, 2474928K cached
CPU: 30% usr 27% sys 0% nic 30% idle 10% io 0% irq 2% sirq
Load average: 4.39 2.98 2.67 4/1349 3078935
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
92411 92354 app S 2948m 19% 2 0% {Web Content} /usr/lib/firefox/fir
92354 92251 app S 2748m 17% 2 0% /usr/bin/firefox --profile /config
92496 92354 app S 2426m 15% 3 0% {WebExtensions} /usr/lib/firefox/f
92237 91948 root S 75180 0% 0 0% /usr/bin/x11vnc -display :0 -rfbpo
92194 91952 app S 29080 0% 3 0% /usr/bin/openbox
92157 91950 root S 24476 0% 0 0% /usr/bin/Xvfb :0 -screen 0 1024x12
92182 92134 nginx S 8392 0% 3 0% nginx: worker process
92183 92134 nginx S 8380 0% 1 0% nginx: worker process
92134 91946 root S 7940 0% 3 0% nginx: master process /usr/sbin/ng
92293 92212 root S 1576 0% 0 0% {tailstatusfile} /bin/sh /usr/bin/
3078931 0 root R 1576 0% 3 0% top -n1
92251 91947 app S 1576 0% 1 0% {firefox_wrapper} /bin/sh /usr/bin
92292 92222 root S 1568 0% 1 0% tail -n0 -F /config/log/firefox/er
3078930 92293 root S 1568 0% 0 0% sleep 5
92125 34 daemon S 492 0% 0 0% s6-fdholderd -1 -i rules
1 0 root S 192 0% 0 0% s6-svscan -s -t0 /var/run/s6/servi
91950 1 root S 192 0% 1 0% s6-supervise xvfb
91948 1 root S 192 0% 1 0% s6-supervise x11vnc
91951 1 root S 192 0% 1 0% s6-supervise logmonitor
91946 1 root S 192 0% 3 0% s6-supervise nginx
I have about 20 conatiners running 24/7 (including Nextcloud, Jellyfin, HomeAssistant and tensorflow) and firefox is the top RAM consumer even at this low (~800MB) usage. I cannot afford to used it since I only have 16GB of RAM on the server and I am at steady 10-12 GB constantly. I dont wanna crash the server.
If there are any option for eliminating RAM build-up I would be very happy!
After having HomeAssistant up for a day or two, the RAM usage was up to about 4 GB. After closing the tab almost all the RAM was freed. Maybe it is a problem with the page? Or is it Firefox?
For sure Firefox itself can take a lot of memory. As you see with your top command, Firefox is the one taking the memory. Are you using any extension ?
I have Firefox opened with many tabs (~20) for several weeks, and here is what I have:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
31a6668258a6 Firefox 9.09% 1.505GiB / 15.38GiB 9.79% 800MB / 1.7GB 117GB / 98MB 327
So your 4gb usage seems high... Is the memory is increasing only when HomeAssistant page is opened? If yes, then I would say the page itself can be the problem (maybe a JavaScript leak?).
The same problem, Firefox's memory usage look like don't be freed, is growing all the time. Becouse after few hours, the server's memory fills up and crashed.
Then I have to reboot the server and open Firefox again, and few hours latter,crashed and repeat the above.
Mem: 3878328K used, 136056K free, 172780K shrd, 72788K buff, 1650444K cached
CPU: 23% usr 4% sys 0% nic 72% idle 0% io 0% irq 0% sirq
Load average: 1.35 1.20 0.97 2/617 1652
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
708 1 app S 2984m 76% 1 12% /usr/lib/firefox/firefox --profile
888 708 app S 2737m 70% 1 7% {Isolated Web Co} /usr/lib/firefox
978 708 app S 410m 10% 2 2% {RDD Process} /usr/lib/firefox/fir
833 708 app S 2426m 62% 2 0% {WebExtensions} /usr/lib/firefox/f
788 708 app S 2335m 59% 1 0% {Privileged Cont} /usr/lib/firefox
960 708 app S 2310m 59% 3 0% {Web Content} /usr/lib/firefox/fir
892 708 app S 2309m 59% 3 0% {Web Content} /usr/lib/firefox/fir
906 708 app S 2309m 59% 1 0% {Web Content} /usr/lib/firefox/fir
979 708 app S 246m 6% 3 0% {Utility Process} /usr/lib/firefox
761 708 app S 179m 5% 3 0% {Socket Process} /usr/lib/firefox/
674 1 app S 44040 1% 3 0% Xvnc -nolisten tcp -nolisten local
689 1 app S 43872 1% 2 0% /opt/base/bin/openbox --config-fil
685 679 app S 6728 0% 1 0% nginx: worker process
686 679 app S 6728 0% 0 0% nginx: worker process
679 1 app S 6272 0% 0 0% nginx: master process /opt/base/sb
1647 0 root R 1620 0% 2 0% top -n1
1 0 root S 980 0% 0 0% /opt/base/sbin/cinit --progname su
Maybe the matter of extension, after i disable all expansions, the RAM usage go down