maintainer-feedback requested: [Bug 263436] www/firefox uses excessive amount of memory

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 20 Apr 2022 13:19:17 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-gecko (Nobody)
<gecko@FreeBSD.org> for maintainer-feedback:
Bug 263436: www/firefox uses excessive amount of memory
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263436



--- Description ---
Unfortunately, I don't have much hard data to present.	Ever since I upgraded
to Firefox 98, my system's RAM (16G) and swap (2G) get nearly exhausted within
a couple of days of starting Firefox.  Restarting Firefox releases all the
memory as expected and all is well for 2-3 days before the memory consumption
gets high enough to cause unnecessary paging.  Before the upgrade to v98, I
used to run firefox for weeks without *any* issues like this.

Normally I use a couple of extensions, but I've reproduced it without any
extensions enabled.


$ grep firefox /var/log/messages
Jan 20 14:23:29 satis pkg[1355]: firefox upgraded: 90.0.1,2 -> 95.0.2_2,2 
Mar 19 12:55:28 satis pkg[91791]: firefox upgraded: 95.0.2_2,2 -> 98.0.1,2 
Mar 28 22:30:31 satis kernel: pid 4282 (firefox), jid 0, uid 1000, was killed:
out of swap space
Apr  3 09:31:13 satis pkg[27892]: firefox upgraded: 98.0.1,2 -> 99.0,2 
Apr  6 23:13:24 satis kernel: pid 10976 (firefox), jid 0, uid 1000, was killed:
out of swap space
Apr 10 18:47:58 satis pkg[1460]: firefox upgraded: 99.0,2 -> 99.0_1,2 
Apr 16 17:27:15 satis pkg[81292]: firefox upgraded: 99.0_1,2 -> 99.0_2,2 
Apr 19 00:04:57 satis kernel: pid 6668 (firefox), jid 0, uid 1000, was killed:
out of swap space
Apr 19 00:04:59 satis kernel: pid 82135 (firefox), jid 0, uid 1000, was killed:
out of swap space
Apr 19 00:05:01 satis kernel: pid 7545 (firefox), jid 0, uid 1000, was killed:
out of swap space


The firefox got killed because it ran the system out of memory on the 19th.  I
restarted it, and after ~10 hours of mostly idling it was:

$ ps aux|egrep '(COMMAND|firefox)'
USER	     PID  %CPU %MEM	 VSZ	RSS TT	STAT STARTED	    TIME
COMMAND
jeffpc	   12355   0.1	7.1 11646412 593476 v0	S    09:48	 0:18.64
firefox
jeffpc	   12357   0.0	1.6   287388 129120 v0	I    09:48	 0:00.05
/usr/local/lib/firefox/firefox -content
jeffpc	   12358   0.0	2.0  2532140 168012 v0	I    09:48	 0:00.48
/usr/local/lib/firefox/firefox -content
jeffpc	   12359   0.0	1.9  2522204 159644 v0	I    09:48	 0:00.38
/usr/local/lib/firefox/firefox -content
jeffpc	   12362   0.0	4.6  2956960 381616 v0	S    09:48	 0:04.63
/usr/local/lib/firefox/firefox -content
jeffpc	   12363   0.0	2.9  2794572 238748 v0	S    09:48	 0:01.76
/usr/local/lib/firefox/firefox -content
jeffpc	   12367   0.0	1.8  2506476 148620 v0	I    09:49	 0:00.26
/usr/local/lib/firefox/firefox -content
jeffpc	   12368   0.0	2.5  2567212 204548 v0	S    09:49	 0:00.95
/usr/local/lib/firefox/firefox -content
jeffpc	   12369   0.0	1.9  2516688 160500 v0	S    09:49	 0:00.78
/usr/local/lib/firefox/firefox -content
jeffpc	   12370   0.0	2.0  2526916 163660 v0	I    09:49	 0:00.34
/usr/local/lib/firefox/firefox -content
jeffpc	   12372   0.0	2.1  2533480 176008 v0	S    09:49	 0:02.67
/usr/local/lib/firefox/firefox -content
jeffpc	   12373   0.0	1.8  2503872 145752 v0	I    09:49	 0:00.12
/usr/local/lib/firefox/firefox -content
jeffpc	   12394   0.0	1.8  2503868 146488 v0	I    09:49	 0:00.11
/usr/local/lib/firefox/firefox -content
jeffpc	   12395   0.0	1.8  2503872 146452 v0	I    09:49	 0:00.11
/usr/local/lib/firefox/firefox -content
jeffpc	   12445   0.0	0.0    12868   2016  7	S+   09:53	 0:00.00 egrep
(COMMAND|firefox)

Another 24 hours later (with some evening/morning browsing and lots of idling
during the day/night):

$ ps aux|egrep '(COMMAND|firefox)'
USER	     PID  %CPU %MEM	 VSZ	 RSS TT  STAT STARTED	     TIME
COMMAND
jeffpc	   12355   0.6 12.5 12928316 1039292 v0  S    09:48	 20:39.08
firefox
jeffpc	   17248   0.2	7.6  3500156  633440 v0  S    20:29	  7:34.43
/usr/local/lib/firefox/firefox -conten
jeffpc	   17436   0.2	6.5  3633244  541748 v0  S    20:54	  8:38.38
/usr/local/lib/firefox/firefox -conten
jeffpc	   16833   0.1	5.5  3447880  460024 v0  R    19:35	  5:51.86
/usr/local/lib/firefox/firefox -conten
jeffpc	   12357   0.0	1.1   287516   94092 v0  I    09:48	  0:00.10
/usr/local/lib/firefox/firefox -conten
jeffpc	   12358   0.0	1.7  2616232  143672 v0  I    09:48	  0:06.67
/usr/local/lib/firefox/firefox -conten
jeffpc	   12359   0.0	1.4  2529100  112988 v0  I    09:48	  0:01.75
/usr/local/lib/firefox/firefox -conten
jeffpc	   12362   0.0	6.5  3359912  537288 v0  S    09:48	  4:46.52
/usr/local/lib/firefox/firefox -conten
jeffpc	   12363   0.0	2.7  3064288  226496 v0  S    09:48	  2:10.52
/usr/local/lib/firefox/firefox -conten
jeffpc	   12367   0.0	1.4  2525440  113836 v0  S    09:49	  0:04.57
/usr/local/lib/firefox/firefox -conten
...20 lines omitted...
jeffpc	   23084   0.0	1.6  2523704  135192 v0  S    08:49	  0:01.00
/usr/local/lib/firefox/firefox -conten
jeffpc	   23085   0.0	1.5  2506320  125904 v0  S    08:49	  0:00.56
/usr/local/lib/firefox/firefox -conten
jeffpc	   23086   0.0	1.5  2505404  125068 v0  S    08:49	  0:00.53
/usr/local/lib/firefox/firefox -conten
jeffpc	   23087   0.0	1.7  2551240  140020 v0  S    08:49	  0:00.89
/usr/local/lib/firefox/firefox -conten
jeffpc	   23088   0.0	1.5  2505272  124888 v0  S    08:49	  0:00.50
/usr/local/lib/firefox/firefox -conten
jeffpc	   23099   0.0	4.8  2904628  396040 v0  S    08:50	  0:35.20
/usr/local/lib/firefox/firefox -conten
jeffpc	   23109   0.0	1.5  2503872  122596 v0  I    08:51	  0:00.27
/usr/local/lib/firefox/firefox -conten
jeffpc	   23205   0.0	1.5  2503872  126068 v0  S    08:59	  0:00.27
/usr/local/lib/firefox/firefox -conten
jeffpc	   23236   0.0	1.5  2503872  126860 v0  I    09:02	  0:00.18
/usr/local/lib/firefox/firefox -conten
jeffpc	   23253   0.0	0.0    12868	1932  7  S+   09:04	  0:00.00 egrep
(COMMAND|firefox)


What the ps(1) output doesn't show is that the virtual size of one of the
processes seems to climb to as high as 25GB when actively browsing the web but
quickly drop back down to "reasonable" single digit GB.

Let me know what other information I should collect or what I should try to get
to the bottom of this.