Closed Bug 1177625 Opened 9 years ago Closed 7 years ago

Firefox hangs frequently when RAM consumption exceeds 2 gb

Categories

(Core :: JavaScript Engine, defect)

44 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: eodmnyio, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: hang, perf)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150618135210

Steps to reproduce:

Open 100+ tabs specially tabs with flash content and then use the browser normally



Actual results:

Firefox will start to hang periodically for 1,5~2 seconds.


Expected results:

Not hang.

(Hardware limitations is not the cause of this. Version used is x64 as x32 version usually end on out of memory crashes)
Over in GitHub this person said they have some ghost windows:
  https://github.com/mozilla/memchaser/issues/221

A ghost window is a window that you have closed, but for some reason hasn't been cleaned up. This is bad both because the memory gets freed, and because it makes the cycle collector very slow.

The question is if you can reproduce the issue that leads to the ghost window. It may involve something with an addon, like some kind of video saver addon.
I don't have any add-on that saves videos.

Here is the "information to solve problems" http://pastebin.com/kZ450Z9c

I've tried 3 times in the time period of one year making a new profile from scratch only importing the bookmarks and passwords and always ended up with the same issue. I've also tried fully uninstalling flash and reinstalling it. I've tried disabling hardware acceleration from firefox and flash.
Keywords: hang
unless 100+ means "a lot more than 100 tabs", 1gb is rather low point at which to be experiencing performance problems, so I doubt the problem is just simply memory usage and the resulting gc overhead.  

You have plenty of addons which might make performance worse.  Personally, as a workaround, I would reenable flashblock, and at least temporarily try to live without some of the addons.

FWIW, I run 64bit trunk  builds with e10s enabled and can handle 300-500 tabs very well.  And more recently I've set dom.ipc.processCount to 2, and performance is even better.
Yeah, ghost windows cause performance problems even when they aren't using a huge amount of memory.
Im eodmnyio changed my mail on github and bugzilla made me create an other account.

@wayne

I tested firefox 40 a bit before and the performance with e10 was better but I'm using 39 atm.

I never had flashblock but I use ublock (an ad blocker) that block all the flash garbage elements and unload tabs that only keeps a few tabs loaded at a time. Like I said before this issue was present even when I created a fresh new profile form 0 and reinstalled all the add-ons and I have a i7 processor and 12gb ram so I dobut that limited resources is the issue.

If you are using other builds than release then you might not suffer the issues cause they might be existent on the build you use or the performance that it offer over the release build might make it unnoticeable.
You could try disabling Greasemonkey, or installing the beta version of Greasemonkey 3.3:
https://addons.mozilla.org/firefox/downloads/file/327786/greasemonkey-3.3beta1-fx.xpi

There have been a couple of other ghost window issues caused by some interaction of Greasemonkey and Firefox, like bug 1174950.
Blocks: GhostWindows
Hi, 

Are you still experiencing the issue on the latest Firefox versions? e.g. Firefox 43 / Nightly 47.
Have you tried the advice from comment 6?
Flags: needinfo?(eodmnyio)
Flags: needinfo?(iraola887)
I'm still experiencing this issue and I'm on firefox 44 release. I haven't tested the beta or dev version. The greasemonkey beta version with the fix was 3.3 and they are now in 3.6 so probably the "fix" went to release but I'm still having the issue so whatever the fix was didn't fix the hangs it could have fixed the ghost windows cause I haven't seen them when I checked but if that's the case then the hangs are not related to the ghost windows.

Since I've posted this I've stopped using memchaser also so that add-on wasn't the problem either.

Is there anything I could do to give you more information on how to solve this?
Flags: needinfo?(iraola887) → needinfo?(liviu.cirdei)
So...just to confirm, is this happening only when you have Greasemonkey enabled? 
Have you tried Firefox Safe mode? Safe mode disables your addons (https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode). If you haven't tried yet, please check if the hang still exist in Firefox Safe mode.
Flags: needinfo?(liviu.cirdei)
I tested on a new clean profile with no add-ons installed and the hangs still happen although they are a bit shorter but after some time you start noticing the animation on the loading tabs getting choppier and when switching tabs it will sometimes hang for like 1 sec or 2. So the add-ons might hinder it a bit but it's not because of the add-ons that happens.
My gf tested this also on her profile on a even better performance pc and experienced the same issue. To test try this open 200 tabs on 3 windows at least 20 of them make them be youtube pages or some video streaming or other heavy pages. Check the task manager to see if the ram consumption for firefox is around 2 gigs then start switching between tabs and windows and in less than 3 min you'll start noticing that firefox hangs for about 1 or 2 seconds at least.
Flags: needinfo?(liviu.cirdei)
User Agent 	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID 	20160123151951

Thank you. I tried to reproduce and I could see Firefox hanging when the memory consumption was around 2.7 - 3 gb.
Status: UNCONFIRMED → NEW
Component: Untriaged → General
Ever confirmed: true
Flags: needinfo?(liviu.cirdei)
Flags: needinfo?(eodmnyio)
OS: Unspecified → Windows 7
Product: Core → Firefox
Hardware: Unspecified → x86
Summary: Firefox hangs frequently when RAM consumption exceeds 1gb → Firefox hangs frequently when RAM consumption exceeds 2 gb
Version: 39 Branch → 44 Branch
(In reply to Liviu Cirdei from comment #12)
> User Agent 	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101
> Firefox/44.0
> Build ID 	20160123151951
> 
> Thank you. I tried to reproduce and I could see Firefox hanging when the
> memory consumption was around 2.7 - 3 gb.

Can you create a performance profile?

Please don't move bugs to Firefox::General just because it's not clear where the issue is.
Component: General → Untriaged
Flags: needinfo?(liviu.cirdei)
Keywords: perf
Product: Firefox → Core
I think this is related to OOM conditions. I could only reproduce the issue when my machine was about to run out of memory. Sometimes Firefox crashed while reproducing it.
I tried to make a performance profile too but I didn't manage to because Firefox crashed due to OOM. If the root cause of the bug is OOM, I don't think we can do something about it. 
Here are some crash reports:
https://crash-stats.mozilla.com/report/index/bf581fcc-5f99-4044-ad4e-560e12160201
https://crash-stats.mozilla.com/report/index/33f25501-2723-4996-869b-4db612160201
https://crash-stats.mozilla.com/report/index/aef7240f-0e47-4a43-be39-12e672160202
https://crash-stats.mozilla.com/report/index/862ddb3d-c1ca-411c-9b8f-31bbc2160202
Flags: needinfo?(liviu.cirdei)
I finally managed to take a profile performance. The profile was taken when the tab switches were taking half a second instead of 1-2 seconds. Hope this would help to track down what causes the issue.
https://cleopatra.io/#report=bc557333da0f8c251b6eaa67b2c617e2a266f7fe
(In reply to Liviu Cirdei from comment #15)
> I finally managed to take a profile performance. The profile was taken when
> the tab switches were taking half a second instead of 1-2 seconds. Hope this
> would help to track down what causes the issue.
> https://cleopatra.io/#report=bc557333da0f8c251b6eaa67b2c617e2a266f7fe

Andrew, anything you can make of this? I spotted that towards the end of the profile, time between frames goes up noticeably (to around 50ms instead of 16-17) and there's a couple of non-tiny (but equally, not huge) GCs. We also seem to be spending quite some time in timeout runs from youtube and other tabs that are open, but I didn't find something that really jumped out at me - but maybe I'm not looking in the right places?
Flags: needinfo?(continuation)
Are you using the x64 version of firefox? Cause theoretically if you use a x64 build the out of memory crashes shouldn't occur (it does not crash for me). If like you said it's related to OOM then there is some issues with how the x64 version works cause it should be able to use all the available ram properly.
Flags: needinfo?(liviu.cirdei)
(In reply to :Gijs Kruitbosch from comment #16)
> Andrew, anything you can make of this?

I don't know how to usefully interpret SPS logs, sorry.
Flags: needinfo?(continuation)
I use x32 not x64 version of Firefox.
Flags: needinfo?(liviu.cirdei)
Could you, please, help us with the Cleopatra report? Can you see any clue in it which might help understanding what causes the issue?
Flags: needinfo?(bgirard)
I looked at the profile and things just seem slow everywhere. I wonder if the machine is starting to swap?
Flags: needinfo?(bgirard)
In my case it just happens to firefox the rest is fine I can even play very demanding games while firefox is in that state. Like I mentioned before there shouldn't be an issue with hardware limitations cause I have 12gb ram and an i7 processor and a radeon hd video card. If it's something related to hardware it would probably be that firefox even in x64 version is not using all the resources it can.
Flags: needinfo?(bgirard)
There's not much info I can provide and there's not much I can do without being able to reproduce the problem.
Flags: needinfo?(bgirard)
To test try this open 200 tabs on 3 windows at least 20 of them make them be youtube pages or some video streaming or other heavy pages. Check the task manager to see if the ram consumption for firefox is around 2 gigs then start switching between tabs and windows and in less than 3 min you'll start noticing that firefox hangs for about 1 or 2 seconds at least.

Let me know what OS you are on and what version of FF you are using please.
Flags: needinfo?(bgirard)
Flags: needinfo?(bgirard)
Why did you take it off without answering?
Flags: needinfo?(bgirard)
Because I've said in Comment 23 that I don't have any information to provide for this bug and I don't have time to investigate this bug myself as I'm working on other bugs.
Flags: needinfo?(bgirard)
Liviu, can you please try reproducing this again with a 64-bit build so we can avoid OOM complicating things? Thanks!
Flags: needinfo?(liviu.cirdei)
An about:memory report when it's in this state could be useful too in addition to an updated profiler run.
Hi Ryan, 

I tested on a x64 Firefox build on Windows 7. Here is the profiler (the issue is at the end of it): https://cleopatra.io/#report=a876ddb0011a845074fbb5b2c51a9b6304fc77ce

I will attach a memory report too. 

Please let me know if I can do anything else.
Flags: needinfo?(liviu.cirdei)
Attached file memory-report.json.gz
Lots of time executing JS and in garbage collection. I guess that's not too surprising for a situation like this.
Component: Untriaged → JavaScript Engine
Looking at the memory report, there's 1.8GB of window things, mostly from many YouTube windows. There's also 1.8GB under media/resources. That doesn't sound too unreasonable given all of the youtube tabs there are open. I'm not sure what we can do better, asides from maybe enforcing a limit on how many videos we try to play at once.
@Andrew

The problem is not the amount of memory consumed but the fact that firefox independently of the available hardware resources it starts to hang and get clunky when you reach that point and the more you stay at the point the clunkier/hangier it gets.
Unfortunately there's not enough information in this bug to do anything.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: