Open Bug 1351194 Opened 7 years ago Updated 2 years ago

Many unloaded tabs -> excessive CPU and RAM usage on Youtube, Facebook, etc.

Categories

(Firefox :: Tabbed Browser, defect)

x86_64
Windows 8.1
defect

Tracking

()

UNCONFIRMED

People

(Reporter: r_rom, Unassigned)

Details

(Keywords: perf, Whiteboard: [MemShrink:P3])

Attachments

(1 file)

Until today, I'd been using Firefox with over 350 tabs open. Most of them weren't fully loaded. I think this is called being in unloaded state.

Watching Youtube started to be unbearable in the last weeks. Very often, RAM usage would rise to over 1 and 2 GB, within a minute or so.

Similar thing would happen on Facebook and ok.ru, though significantly more slowly.

CPU usage was VERY high too (80 to 100%).

All of that slowed down the entire system greatly.

Loading the profile in safe mode didn't help. Neither did refreshing the profile. The only thing that has eliminated the problem was to close the old tabs.

I've first noticed this not too long ago. I'd guess in March 2017.
Currently using 55.0a1 (2017-03-27) (32-bit)
FYI: bug 906076.
Component: General → Tabbed Browser
Keywords: perf
Whiteboard: [MemShrink]
Do you think you can find a regression window for this? I'm a bit worried this may have come after the changes from bug 1256472, though that would be surprising given that it's generally been a positive change for folks (CC mconley for this). The other potential cause is the lazy-ifying of browsers which Dão knows about.
Flags: needinfo?(r_rom)
The other possibility would be the increase in content process counts.
Maybe the user can save and attach a session with a minimum of tabs open to reproduce the issue. Like that, everybody will be able test the possible regression.
I will try to find a regression window.

Meanwhile, here are some potentially useful data points:

1. Here's what I've observed sometimes: I was watching a Youtube video for a number of minutes... things seemed good, CPU usage wasn't too high, according to the Task Manager's icon in the system tray. And then I opened the task manager to look at the RAM usage. (The Task Manager was covering a portion of Firefox's window.) The amount I saw was pretty low, BUT within a few seconds, that amount was increasing very quickly until my system didn't have enough RAM to function.

2. If, during the above, I activated a different tab (usually, blank or with only text and maybe some images, or about:memory to run a memory report) before things got too bad, RAM usage decreased quickly (within a small number of seconds). And so did the CPU usage.

With just one tab open (or a small number), during a video playback, I see RAM goes up and down. So, maybe if I have 370 tabs open, the browser doesn't enough resources to GC quickly enough, and RAM usage goes out of control. Just a suspicion on my part.

Nevertheless, CPU usage was too high with 370 tabs often even though, just one might have been doing something intensive. It's much lower now that I have a small number of inactive tabs. It *appears* that those inactive tabs aren't so inactive, after all.
Flags: needinfo?(r_rom)
Can you attach a memory report from about:memory when memory use is high?
Timothy, I don't know how to do that because as soon as I switch to a different tab to run that report, RAM usage plummets practically immediately. Firefox should have a better way to do that. Skype does it better — a registry entry enables Skype to continuously log important data to a file.
You can try opening a new window instead of a new tab and see if that works.
I've just had the problem appear with just 22 tabs and managed to save a memory report. 

The amount of RAM used by Firefox went over 3 GB (for the most RAM-hungry FF process). I ran the memory report and afterwards clicked the "minimize memory usage" button. I saw no improvement and clicked the "Save verbose" in the "Save GC & CC logs" section. After that, RAM usage went down to sane levels (to less than 200 MB for the most RAM-hungry FF process).
Attached file memory-report.json.gz
To clarify, I have no way to know whether any of the actions I described above caused RAM usage plummet. Maybe I only observed a correlation. It's up to you, guys, to determine the cause.
One more thing: I was trying to actively use ok.ru when I noticed that RAM usage was very high. ok.ru wasn't responding properly (wasn't opening a personal message there). And then I closed that tab. Maybe this data point will help somehow.
One more data point:

I've just experienced the same thing again when I opened ok.ru in another tab. RAM usage was rising quickly. But I noticed a bar on the top telling me that the tab was slowing the browser and asked me if I wanted to stop it or wait. The previous time I kept pressing the Wait button thinking that pressing the Stop button would kill the tab. This time, though, I pressed the Stop button and observed that RAM usage went to healthy levels quickly and that the tab with ok.ru worked as expected.

It's been a few minutes since then, RAM usage is still healthy.
The attached memory report doesn't seem to show any process using close to 3 GB. It's possible the about:memory failed to capture the memory use, or the memory was released when you made the memory report.
Maybe.

Can Firefox developers improve the performance logging mechanism and making it more automatic? E.g. the way Skype has done it? The user set an option, and logging begins.
Whiteboard: [MemShrink] → [MemShrink:P3]
1445470 - [tracking] video playback performance
<https://bugzilla.mozilla.org/show_bug.cgi?id=1445470>
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: