Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#4841 closed defect (invalid)

Memory leak when XMLHttpRequests are blocked on a page

Reported by: cc007 Assignee:
Priority: Unknown Milestone:
Module: Adblock-Plus-for-Firefox Keywords:
Cc: trev, mapx, greiner Blocked By:
Blocking: Platform: Firefox
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Environment

CPU: intel i5 4670k
RAM: 16GB
OS: Windows 10 x64
Brownser: Firefox 51 and 52
Adblock version: 2.8.2
Filter lists:

  • Adblock warning removal list
  • EasyList Dutch+EasyList

How to reproduce

  1. Open task manager and look at firefox's memory usage
  2. Start firefox
  3. Repeat 10 times: 3a. open a new tab 3b. go to youtube.com 3c. click on a random video and start the video
  4. close the youtube tabs (make sure that firefox is still open after this)
  5. look at firefox's memory usage again

Observed behaviour

Memory usage skyrockets due to all the youtube videos running (expected) but doesn't go down again after closing the tabs.

Expected behaviour

I expect the memory usage to go down since the tabs are closed (memory usage does go down with ad block plus disabled)

Extra info ==

After using firefox for a whole evening, watching a lot of youtube videos (one by one) and youtube live streams, my memory usage before closing firefox (after closing youtube tabs) was around 7.5 gb. After closing firefox it used 4gb. This means that firefox used about 3.5GB. Without running adblock, in the same kind of state firefox only uses at most 800MB

Proof of high memory usage: http://imgur.com/a/gsZ0G
(Also attached for if the link breaks)

Attachments (2)

firefox adblock plus mem usage.png (40.3 KB) - added by cc007 3 years ago.
High memory usage Firefox with AdBlockPlus
memory-report_anon_3.json.gz (169.9 KB) - added by marcino245 3 years ago.
ADP eating 1.3GB RAM with a single tab + 66 ghost windows

Download all attachments as: .zip

Change History (15)

Changed 3 years ago by cc007

High memory usage Firefox with AdBlockPlus

comment:1 Changed 3 years ago by cc007

It seems to be related to tabs becoming ghost tabs that are prevented from being unloaded by AdBlock Plus

comment:2 Changed 3 years ago by mapx

  • Cc trev mapx greiner added

comment:3 Changed 3 years ago by marcino245

Hello, I have registered on AdBlockPlus Bug Tracker just right now because me and several other people have the same issue, therefore I have wanted to report the bug, but as seen somebody has already reported the bug.

The situation is that there is already the same bug from a few months ago:
on Firefox bugzilla tracker --> https://bugzilla.mozilla.org/show_bug.cgi?id=1281728
and the corresponding one on AdBlock Plus bug tracker --> https://issues.adblockplus.org/ticket/4203

And now there is a new one:
on Firefox bugzilla tracker --> https://bugzilla.mozilla.org/show_bug.cgi?id=1326095
and the corresponding one on AdBlock Plus bug tracker --> https://issues.adblockplus.org/ticket/4841 (this one)

And now the main point is if the new bug is a new bug or it is the same bug which has just returned? Because noone is 100% sure the final decision belongs to the author and developers of AdBlockPlus, therefore we are awaiting the final decision.

comment:4 Changed 3 years ago by trev

I'm looking into this. For reference, Task Manager is a very bad way to look a Firefox memory usage. There is about:memory which can measure the memory used and what it is spent on, it can also force unused memory to be freed.

Note that #4203 is definitely resolved, this issue is gone. The symptoms described here are common for any memory leak however, regardless of what it is caused by.

comment:5 Changed 3 years ago by trev

  • Component changed from Unknown to Adblock-Plus-for-Firefox

comment:6 Changed 3 years ago by trev

So far I can see image (and presumably others as well) nodes leaking because the corresponding wrapper is rooted. From what I can tell, there is no further useful information in the GC and CC logs - in particular, it's not obvious what mechanism forgot to unroot wrappers here. I'll continue by testing which extension functionality triggers this behavior.

comment:7 Changed 3 years ago by marcino245

I think that the title of the bug should be more accurate, and therefore changed to:
"Huge memory usage due to ghost tabs, which causes Firefox to be unusable: unresponsive, laggy and even crash."

because the bug is not only about huge memory leak, in mine's and two other persons's case (see https://bugzilla.mozilla.org/show_bug.cgi?id=1326095) ADP also slows Firefox down. The more memory ADP is leaking with time (from hour to hour), the less responsive Firefox becomes, switching between tabs and typing becomes slow etc. If the memory leak reaches the limit of RAM, this often causes FF to crash. In such a situation ADB causes FF to be unsuable, therefore ADP has to be disabled which results in the people switching to uBlock Origin until the leak is fixed.

Changed 3 years ago by marcino245

ADP eating 1.3GB RAM with a single tab + 66 ghost windows

comment:8 Changed 3 years ago by marcino245

I have had to kill FF exe process in Windows Task Manager right now, because after several or a dozen of hours of websurfing ADP has made FF completely unresponsive and almost frozen - FF exe process has just froze, looped at 100% CPU's single core usage, 1.3GB of RAM used with a single or two tabs, 66+ ghost-windows, it is already umpteenth time, when I'm being forced to restart FF every several or a dozen of hours of websurfing. I'm thinking about temporarily switching to uBlock Origin until the nasty leak will be fixed.

░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄
░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄
░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█
░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█
░▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█
█▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█
█▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█
░█▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█
░░█░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█
░░░█░░██░░▀█▄▄▄█▄▄█▄████░█
░░░░█░░░▀▀▄░█░░░█░███████░█
░░░░░▀▄░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█
░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░█
░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░█
░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░█

comment:10 Changed 3 years ago by trev

This issue is caused by Adblock Plus blocking XMLHttpRequests, disabling all filters and adding *$xmlhttprequest,domain=youtube.com instead is sufficient to reproduce the leak on YouTube video pages reliably. The leak itself appears to be in the Firefox code, I'll need to produce a testcase to prove that.

comment:11 Changed 3 years ago by trev

  • Summary changed from Unacceptable memory usage due to ghost tabs to Memory leak when XMLHttpRequests are blocked on a page

comment:12 Changed 3 years ago by trev

  • Resolution set to invalid
  • Status changed from new to closed

Resolving as invalid, this is definitely a Firefox bug (see https://bugzilla.mozilla.org/show_bug.cgi?id=1326095#c24).

comment:13 Changed 3 years ago by marcino245

My apologies then Wladimir, I have been constantly thinking about that it might be not necessarily an AdBlock's bug, but a Firefox's bug, but there have been 3 facts which have misled me:

1) in https://bugzilla.mozilla.org/show_bug.cgi?id=1326095#c11 Mike Conley has strongly suggested that it is rather an add-on's bug

2) there already has been a bug before in AdBlock, which has been giving the same sympthoms:
https://issues.adblockplus.org/ticket/4203

3)and the corresponding one: https://bugzilla.mozilla.org/show_bug.cgi?id=1281728
has been having the same title like: https://bugzilla.mozilla.org/show_bug.cgi?id=1326095

but you have proved that this time it was a Firefox's bug, well done. I had no intention to ruin reputation of AdBlock Plus.

Note: See TracTickets for help on using tickets.