Firefox is leaking memory on my system

I recently reinstalled FreeBSD because of issues I couldn't fix (It was constantly panicking, even in SU mode), and now, after rebuilding my whole setup, Firefox is giving me problems. I thought it could be a bug in the most recent version, so I switched to firefox-esr, same results.

The process /usr/local/lib/firefox starts eating more and more RAM when Firefox is in use. Even if I quit Firefox, this process stays and keeps eating RAM. I can't kill it, not even with the root user. It soon gets to the point where my machine can no longer operate properly and I'm forced to reboot. This is an underpowered (for today's standards) laptop with only 1.5G of RAM, so this is a huge deal.

Has anyone been experiencing anything similar?

Thanks, everyone.
 
You haven't mentionned what version of FreeBSD you're using? Is it up to date (latest patch level)?

Unless something is seriously messed up, FreeBSD rarely needs reinstalling.

Have you tried other browsers? Even if you don't intend to use them in the long-term, do install a few others, try them for a while and check for similar symptoms.

A 1.5GB memory may not be enough at all if you installed on ZFS, are using a full-bore desktop environment and expect to run such a beast as Firefox (Firebrontosaurus is more like it). Or it may be more than enough if you installed on UFS and are only using a window manager and a few other applications.
 
Seamonkey started using more memory with just a tabs open after a pkg update from a few weeks ago, maybe after the xorgproto switchover... just guessing.
 
Firefox takes average 325M of RAM per open tab. Still my 2GB of RAM is good enough for normal use. Building from base up & adding required packages gradually may be a good idea. Can identify the cause of panic.
 
The process /usr/local/lib/firefox starts eating more and more RAM when Firefox is in use.
Seamonkey started using more memory with just a tabs open

What I've noticed, is that my system started to use much more RAM
while I'm doing regular tasks, like browsing in any firefox based browser,
it happened after upgrade to 11.2, but also may be after some pkg upgrades,
I'm not sure what's causing this.
 
I've been using www/firefox as my main browser the past couple months and am currently at FreeBSD 11.2-RELEASE-p3. I haven't noticed anything out of the ordinary as far as resource usage with it, but saw this post last night and took note of my system stats before visiting Demonica.

That was almost 7 hour ago, I've had at least 4 tabs open at all times and right about the same as I was when I started, if not to the good 360MB RAM. I have www/palemoon open to post this from now too, since I am still logged in there with Firefox. Mozilla based browsers are all I use.

I've got 8GB RAM. It does show me using 10MB Swap in top, but I started it when I saw this post and it was using that much then:

screenfetch.png top.png
 
I have an older workstation FreeBSD-11.1-p6, 4GB RAM, firefox 61. It's a memory leaker. I tested this recently after my 12G of swap was up to 89%, closed all 6 firefox instances and swap dropped to 2%.

I'm writing this on QupZilla.
 
The "my browser leaks memory!" issue arises every time someone has a high memory usage program and usually posted by someone who doesn't really understand what a memory leak is. About 10 years ago this was an issue with Firefox and it quickly went away. I live in the browser and have not noticed any problems but I've been doing testing with Chrome the past two weeks.
 
After downgrading to 11.1 this issue disappeared for me,
also it is definitely doesn't related anyhow to "understanding what a memory leak is", because this problem is very obvious -- RAM and SWAP are always almost full, even after closing all applications, and your machine starts to be very slow, you're lucky if you don't have this issue, drhowarddrfine. Also, it seems, it is not a kernel problem, because just changing kernel to 11.1 didn't change nothing -- RAM is always full and SWAP is always almost full, but after installing 11.1 world, the issue gone away for me. Also I reinstalled all packages from "quarterly" repo after downgrade (I used "latest" before), so maybe it solved the problem, I'm not sure what helped exactly. The easiest way to reproduce this issue - while using 11.2, start using some X applications, that use RAM actively, and if your RAM memory doesn't free up then, you have this issue.
 
Hey folks, although I haven't had time to reply, I was keeping up with this thread.

I'm using FreeBSD 11.2-RELEASE. I don't have a desktop environment installed and I'm not on ZFS. It's just WindowMaker and a dozen dockapps, no compositor.

I was not familiar with the fact that firefox might take >300MB per open tab, in fact I never bothered to check, because I never had this problem. It doesn't take this much on my system for subsequent tabs. I actually tried to fill my RAM by opening like 6 or 7 tabs of heavy websites, but that was not enough and is way out of my usual browsing behavior. After switching to firefox-esr, I went back to regular firefox, which was already a version newer than I was using initially. This issue seems to be happening less frequently, although it could be just coincidence.

When this issue arises, I usually only have two or three tabs open. I capped a moment when this happened in the middle of last week. This time memory was still not full (although almost) when I succesfully closed firefox. Then one of the processes was succesfully killed, but another remained and started going on a RAM binge. I tried killing it multiple times, but it only died after around 4 minutes. The first screenshot is from before closing firefox, the other three are after.

This happened again today and again I was able to reproduce the same behavior, i.e. closing firefox before it fills the RAM. Even after managing to kill all the processes and resource usage going back to normal, my system was still very slow, which leads me to believe that this is not an issue with firefox itself, but a system stability issue that's causing firefox to misbehave.

Screenshot_2018-09-26_14-24-00.png Screenshot_2018-09-26_14-24-55.png Screenshot_2018-09-26_14-25-57.png Screenshot_2018-09-26_14-27-46.png

EDIT: Looking again at these screenshots, it seems that the screenshooter processes also both lingered around for a while and are using more RAM in the last screenshot...
 
IMO it isn't a problem with firefox, it is a problem with system,
after downgrade to 11.1 using # freebsd-update upgrade -r 11.1-RELEASE
I have no problems with www/firefox or www/firefox-esr,
FF works very fine and RAM usage is OK (I use ZFS on this machine).
 
I stopped using FreeBSD for a couple months until 11.2 was released because in 11.1 the kernel panicked every time firefox started. The crash log confirmed that firefox was the cause. I'm not willing to go back to 11.1, especially when 11.2 supports vdpau, which is very important on a laptop like this one.
 
Firefox is an equal opportunity memory leaker: OS/X, Windows, Linux, BSD's it does not disciminate. It is more a matter of how much leaking you will tolerate in order to access web content in multiple tabs, popups and pop-unders.
For what its worth, Theo de Raadt weighed in:
Chromium vs Firefox
OpenBSD has been able to get chromium to "pledge" while it Failed in Firefox.
 
I'm running FreeBSD 11.2 with Mate on most of my systems.

In the last few weeks, Firefox has had the habit of first freezing and then crashing. Eventually, there's only one FF process running and it takes up a lot of the CPU's time, sometimes more than 40%. That process usually dies after a few minutes.

I thought it was only an 11.2/Mate problem, but I have a laptop with 11.2 and Xfce and Firefox behaves the same on that.

It doesn't seem to matter which circumstances it misbehaves. I thought it might be associated with a specific website (e. g., YouTube) but that doesn't seem to be the case. I thought that it might have something to do with me keeping several tabs open but when I tried opening new windows instead of tabs, the same thing happened. Even clearing the cache after launching it didn't seem to make any difference.

If I have maybe 2 or 3 tabs open, however, it seems to play nice with me.
 
I'm experiencing the same issue. I'm also running Xfce on 11.2 p5. Before upgrading to FFv64.0, Firefox had always been rock solid for me from FreeBSD 9.0, through 10.x right up to 11.2.

As you mention, the browser freezes before eating up CPU and then crashing. Restarting the browser brings back all tabs, although sometimes I find I have been logged out of any accounts etc. The freeze usually happens for me when I log into one of the larger sites, such as eBay or Amazon.

I don't run any other OS, so can't test whether Firefox exhibits the same issues elsewhere.
 
This no longer seems to be an issue in 12-RELEASE. Although I have only been using it for a couple of days so I can't tell for sure. My theory is that this is some kind of performance hindering bug affecting certain hardware that slipped into 11.1 and the code was replaced by the time 12 got released. And since firefox is the heaviest application we use it's the one that suffered the most. Just thoughts though, please call me out if this is not plausible.
 
In the last few weeks, Firefox has had the habit of first freezing and then crashing. Eventually, there's only one FF process running and it takes up a lot of the CPU's time, sometimes more than 40%. That process usually dies after a few minutes....

It doesn't seem to matter which circumstances it misbehaves. I thought it might be associated with a specific website (e. g., YouTube) but that doesn't seem to be the case. I thought that it might have something to do with me keeping several tabs open but when I tried opening new windows instead of tabs, the same thing happened. Even clearing the cache after launching it didn't seem to make any difference.

If I have maybe 2 or 3 tabs open, however, it seems to play nice with me.
I'm experiencing the same issue. I'm also running Xfce on 11.2 p5. Before upgrading to FFv64.0, Firefox had always been rock solid for me from FreeBSD 9.0, through 10.x right up to 11.2.

As you mention, the browser freezes before eating up CPU and then crashing. Restarting the browser brings back all tabs, although sometimes I find I have been logged out of any accounts etc. The freeze usually happens for me when I log into one of the larger sites, such as eBay or Amazon.

dieselriot may be having this problem with Firefox, but didn't describe it like in the quotes.

Mine started freezing, crashing, then logging me out of accounts. After re-installing or upgrading Firefox, there was a notice which worked.
Put net.local.stream.recvspace=16384 into /etc/sysctl.conf, and use sysctl with this argument to temporarily set it without rebooting. Firefox works smoothly after this. Also, I don't have to go through the trouble of manually killing Firefox operations, after it previously crashing.
 
After re-installing or upgrading Firefox, there was a notice which worked.

Hi, can explain what you mean by this please? Do you mean that the Firefox port/pkg now ships with a notice explaining that this setting needs changing?

Can you also explain what the setting does please? I've tried searching the web for information on it, but I'm not finding much. However, wherever I've found it being set, it seems that the setting 'net.local.stream.sendspace=16384' is also set. So, should I be setting that as well?

For example, this is what I'm seeing on the calomel.org website (although the settings are commented out):

# Increase the localhost buffer space as well as the maximum incoming and
# outgoing raw IP datagram size to 16384 bytes (2^14 bytes) which is the same
# as the MTU for the localhost interface, "ifconfig lo0". The larger buffer
# space should allow services which listen on localhost, like web or database
# servers, to more efficiently move data to the network buffers.
#net.inet.raw.maxdgram=16384 # (default 9216)
#net.inet.raw.recvspace=16384 # (default 9216)
#net.local.stream.sendspace=16384 # (default 8192)
#net.local.stream.recvspace=16384 # (default 8192)


Thanks for your help.
 
Hi, can explain what you mean by this please? Do you mean that the Firefox port/pkg now ships with a notice explaining that this setting needs changing?

Can you also explain what the setting does please? I've tried searching the web for information on it, but I'm not finding much. However, wherever I've found it being set, it seems that the setting 'net.local.stream.sendspace=16384' is also set. So, should I be setting that as well?

For example, this is what I'm seeing on the calomel.org website (although the settings are commented out):
...
#net.local.stream.recvspace=16384 # (default 8192)

Thanks for your help.
The notice suggested to increase sysctl net.local.stream.recvspace=16384 to that value, to that prevent it from crashing. You don't necessarily need to upgrade or reinstall Firefox, but I got that message after doing so from ports. Better yet, you can find this message in /usr/ports/www/firefox/pkg-message. It increases something so it will have room to do functions, and won't crash.

Code:
On FreeBSD < 11.3 Web Content process may frequently crash due to bug 181741.
If you cannot upgrade try applying the following workaround:

$ sysctl net.local.stream.recvspace=16384
Upgrading didn't fix it for me, unless I changed that value. I didn't set net.local.stream.sendspace=16384 # (default 8192): my value for this is still at 8192, and this works. If you want to know more, then you'll have to look up that specific bug.
 
I'm experiencing the same issue. I'm also running Xfce on 11.2 p5. Before upgrading to FFv64.0, Firefox had always been rock solid for me from FreeBSD 9.0, through 10.x right up to 11.2.

As you mention, the browser freezes before eating up CPU and then crashing. Restarting the browser brings back all tabs, although sometimes I find I have been logged out of any accounts etc. The freeze usually happens for me when I log into one of the larger sites, such as eBay or Amazon.

I don't run any other OS, so can't test whether Firefox exhibits the same issues elsewhere.
Thanks. I thought I was the only one with that problem.

Firefox has been troublesome for me for about the last year. When I upgraded it back then, it exhibited some very strange behaviour. Sometimes I would open a tab or window and the page wouldn't load. The browser would simply idle as if it was in an infinite loop.

Sometimes, such as for a YouTube video, the page would open but all I got was the audio track with no video. I could get around that by either opening that same URL again or by opening a tab instead of a window (sometimes the other way around).

This recent behaviour had me concerned. A few weeks ago, it caused my machine to crash with kernel panics.

I'll try what you suggested and see what happens.
 
Upgrading didn't fix it for me, unless I changed that value. I didn't set net.local.stream.sendspace=16384 # (default 8192): my value for this is still at 8192, and this works. If you want to know more, then you'll have to look up that specific bug.

Many thanks for the explanation and your help.
 
I've been pushing Firefox hard for the last couple of hours and so far so good. Yesterday, I could hardly open more than a few tabs without it borking. Looks like this is fixed for me. Thanks again!
 
Back
Top