Opened 2 months ago

Last modified 4 weeks ago

#6067 new defect

[webextension] Firefox displays "Adblock Plus is causing Firefox to slow down." warning

Reported by: lsdornheim Assignee: mjethani
Priority: Unknown Milestone:
Module: Platform Keywords:
Cc: greiner, kzar, sebastian, Ross, mapx, oleksandr, mjethani Blocked By:
Blocking: Platform: Firefox
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by kzar)

Environment

Mac OS 10.12.5 (16F2073), Firefox 57.0, Adblock Plus 3.0.1

Subscriptions: Acceptable Ads, EasyList, Adblock Warning Removal List
All up to date except Adblock Warning Removal List which is giving a "Failed, download failure" error.

One whitelisted domain (sueddeutsche.de), no custom filters.

How to reproduce

  1. Open a new tab.
  2. The warning bar is shown (see screenshot).
  3. Click "wait", notice the warning goes away but then reappears after approximately 10 seconds.
  4. Browse to https://www.facebook.com/ in the tab, notice the warning remains.
  5. Browse to https://www.ebay.de/ in the tab, notice the warning goes after the page had loaded.

Observed behaviour

The warning is shown (see screenshot).

Expected behaviour

No warning from my favorite browser about my favorite extension!

Notes

  • If I have one tab with that notification, the notification automatically is in every new (empty) tab I open until another website is loaded.
  • For some (heavier?) websites the warning reappears after the page had loaded. Facebook, Discourse and https://www.ebay-kleinanzeigen.de also triggers the notification, but ebay.de doesn't.

Attachments (3)

Screen Shot 2017-11-21 at 16.34.22.png (250.2 KB) - added by kzar 2 months ago.
Screen Shot 2017-11-21 at 20.41.27.png (239.3 KB) - added by lsdornheim 2 months ago.
Firefox warning on google search
Screen Shot 2017-11-23 at 1.47.35 PM.png (1.2 MB) - added by mjethani 2 months ago.
Developer Tools performance recording

Download all attachments as: .zip

Change History (31)

comment:1 Changed 2 months ago by greiner

  • Cc greiner added

comment:2 follow-up: Changed 2 months ago by kzar

  • Cc kzar trev sebastian added
  • Component changed from Unknown to Platform
  • Description modified (diff)
  • Summary changed from [webextensions] to [webextension] Firefox displays "Adblock Plus is causing Firefox to slow down." warning

Thanks for the bug report, I have a few questions.

Please could you confirm the Adblock Plus version by browsing to about:addons and then clicking the "More" button by Adblock Plus?

Apart from Acceptable Adverts could you confirm which filter lists you're subscribed to? (Click ABP icon, click Options, click Advanced and then scroll down to FILTER LISTS section.)

Please could you try clicking the UPDATE ALL FILTER LISTS button, and then once they all finished updating seeing if the warning still is displayed?

Please could you also confirm you don't have any custom filters (they are listed below the FILTER LISTS section).

Do you hit Enter before the warning is displayed, or does it display as you're still typing the address?

Do you have much other stuff running? What spec is your computer?

comment:3 Changed 2 months ago by kzar

  • Cc Ross added

Changed 2 months ago by kzar

Changed 2 months ago by lsdornheim

Firefox warning on google search

comment:4 in reply to: ↑ 2 Changed 2 months ago by lsdornheim

Replying to kzar:

Thanks for the bug report, I have a few questions.

Please could you confirm the Adblock Plus version by browsing to about:addons and then clicking the "More" button by Adblock Plus?

Version number 3.0.1

Apart from Acceptable Adverts could you confirm which filter lists you're subscribed to? (Click ABP icon, click Options, click Advanced and then scroll down to FILTER LISTS section.)

Besides Easylist only the "Adblock Warning Removal List".

Please could you try clicking the UPDATE ALL FILTER LISTS button, and then once they all finished updating seeing if the warning still is displayed?

Done, nothing changed. Will restart FF / computer next.

Please could you also confirm you don't have any custom filters (they are listed below the FILTER LISTS section).

Nope, none.

Do you hit Enter before the warning is displayed, or does it display as you're still typing the address?

In a new tab, it is there before I even start typing. It disappears when a new site is loaded. Unless the site triggers the notification again.

Do you have much other stuff running? What spec is your computer?

Not much, and nothing intense. Regular office stuff (Thunderbird, Skype, Spotify...) but I do usually have >10 tabs open. My MacBook is not the most powerful (1,4 GHz Intel Core i7, 16 GB Memory) but I think that is rather average for "normal users".

comment:5 Changed 2 months ago by lsdornheim

I just realized it happens at google. At every single search. That's quite bad...

comment:6 follow-up: Changed 2 months ago by mapx

If I understand correctly your lists (easylist especially) cannot be downloaded ? you get failures ?

What if you unselect easylist (and every other list) and subscribe easylist from here:
http://axistrivia.altervista.org/easy.html

Do you still get that unresponsive scripts / stuff ?

Last edited 2 months ago by mapx (previous) (diff)

comment:7 Changed 2 months ago by mapx

  • Cc mapx added

comment:8 Changed 2 months ago by mapx

nevermind. I can reproduce as well.

go to https://9anime.is/watch/one-piece.ov8/4vo0xo

  • open devtools (press F12) and go to into ABP panel (I was debugging a filter issue, so probably is not the unique way to trigger the wrong behaviour)
  • refresh the page => after a while the message (scripts unresponsive ..) goes out

in the browser console I can see a lot of "TypeError: can't access dead object"

Error: ext is not defined  undefined
Firefox can’t establish a connection to the server at wss://realtime.services.disqus.com/ws/2/thread/5281961594?.  comments:164:43
The connection to wss://realtime.services.disqus.com/ws/2/thread/5281961594? was interrupted while the page was loading.  comments:164:43
TypeError: can't access dead object tab.js:1647:1
TelemetryStopwatch: key "FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS" was already initialized  TelemetryStopwatch.jsm:356
Loading failed for the <script> with source “https://9anime.is/assets/min/frontend/all.js?5a1518d4”.  one-piece.ov8:11
Invalid chrome URI: /TypeError: can't access dead object tab.js:1647:1
Loading failed for the <script> with source “https://jsc.mgid.com/9/a/9anime.to.94438.js?t=11710228”.  one-piece.ov8:1
Loading failed for the <script> with source “https://trends.revcontent.com/serve.js.php?w=83562&t=rc_334&c=1511336715533&width=1288&referer=”.  one-piece.ov8:1
Loading failed for the <script> with source “https://st.bebi.com/bebi_v3.js”.  one-piece.ov8:47
Loading failed for the <script> with source “https://trends.revcontent.com/serve.js.php?w=65320&t=rc_813&c=1511336715690&width=1288&referer=”.  one-piece.ov8:1
Loading failed for the <script> with source “https://st.bebi.com/bebi_v3.js”.  4vo0xo:80
Loading failed for the <script> with source “https://www.google-analytics.com/analytics.js”.  4vo0xo:1
Loading failed for the <script> with source “https://st.bebi.com/bebi_v3.js”.  4vo0xo:128
Loading failed for the <script> with source “https://st.bebi.com/bebi_v3.js”.  4vo0xo:132
Loading failed for the <script> with source “https://www.onclickprediction.com/a/display.php?r=1834015”.  aplayer.html:16
TypeError: can't access dead object tab.js:1647:1
TypeError: can't access dead object tab.js:1647:1
Error: Script terminated by timeout at:
checkNodes@moz-extension://d2871d2e-2485-4e0d-8a2f-1021f8ebbaa9/include.preload.js:402:29
trace@moz-extension://d2871d2e-2485-4e0d-8a2f-1021f8ebbaa9/include.preload.js:498:5

comment:9 in reply to: ↑ 6 Changed 2 months ago by lsdornheim

Replying to mapx:

If I understand correctly your lists (easylist especially) cannot be downloaded ? you get failures ?

What if you unselect easylist (and every other list) and subscribe easylist from here:
http://axistrivia.altervista.org/easy.html

Do you still get that unresponsive scripts / stuff ?

No, easylist was fine. It was the Anti-Adblock-Warnings-List that originally wasn't properly downloaded but that didnt change anything.

comment:10 Changed 2 months ago by lsdornheim

I have restarted Firefox and even with roughly 20 tabs, so far the only warning I got was "a page is slowing down FF".

I got the APB warning on several sessions previously, will keep an eye open when it starts happening again!

comment:11 Changed 2 months ago by kzar

  • Description modified (diff)

Thanks for all those answers, I've updated the issue. So did the Anti Adblock Warning List download in the end, or is that still failing?

comment:12 Changed 2 months ago by oleksandr

  • Cc oleksandr added

comment:13 Changed 2 months ago by mjethani

  • Cc mjethani added

comment:14 Changed 2 months ago by mjethani

I haven't been able to reproduce this on Firefox 57, nor on Firefox Nightly (58.0a1), with adblockpluschrome master.

From the error log it looks like it's getting stuck on iterating over the result of Element.querySelectorAll, which is a non-live NodeList. We're also using the same label for the for...of loop as one of the variable names. It could just be one of those bugs in Firefox (I'm just speculating).

@mapx are you able to reproduce this consistently?

comment:15 Changed 2 months ago by mapx

I tested again (weaker system, windows 7, FF 57, easylist, easyprivacy, easy germany, some other personal filters)

The same test link above.

All the test session keeping opened devtools, ABP panel.

Refresh page, no problem, switch to another episode, all fine.

Switching episodes I get anti adblocking msg, so I add @@||9anime.is^$generichide and from this moment I can reproduce again the error (FF warning) even if I disable the generichide filter. This (probably) could indicate some missing initialization / memory leak too.

comment:16 Changed 2 months ago by mapx

After that first moment going to this page
https://en.pons.com/translate?q=test&l=deen&in=&lf=de

I got repeatedly the same warning / error. A heavy site like cnn ... no problems.
However, I reopened the browser and rechecked pons site => all fine now, no errors / warnings.

So, the assumption of some missing initialization / memory leak is stronger now.

Probably you should test not only in linux.

Last edited 2 months ago by mapx (previous) (diff)

comment:17 Changed 2 months ago by mjethani

I am able to reproduce this now on Firefox 57.0.

I have exactly Laura's setup, including the one whitelisted domain. I'm getting the warning on the 9anime.is URL shared by @mapx. In my case the warning appears briefly and then goes away only to return for another brief period.

I did a 24-second performance recording in Developer Tools and couldn't tell what was obviously causing this to happen. It looks like the extension spends too much time in functions like getSelectorsForDomain, isActiveForDomain, matchesAny, and so on. It's not clear if this is the problem, as the time spent in these functions is still only a few milliseconds.

This will have to be investigated further.

Changed 2 months ago by mjethani

Developer Tools performance recording

comment:18 Changed 2 months ago by mjethani

  • Owner set to mjethani

comment:19 Changed 2 months ago by kzar

(getSelectorsForDomain always was a hotspot, we did some work optimising that a while ago. I suppose it's possible there was a performance regression there since.)

comment:20 Changed 8 weeks ago by mjethani

I looked into this a little more today.

Basically Firefox is complaining that the content script is running for too long. In the case of the Developer Tools panel being open on https://9anime.is/watch/one-piece.ov8/4vo0xo, this can be seen by tracing the performance of ElementHidingTracer.checkNodes. There are ~18,700 selectors, and it has to run Document.querySelectorAll for each one of them and then iterate over the result. Sometimes this can take up to 10 seconds or even longer. This is a good page to test on, because it modifies the DOM every second or so (updating the video player UI), which causes ElementHidingTracer.checkNodes to run at regular intervals. I tried this particular page on Firefox 54.0.1 as well and sometimes there's a warning in that version too, though it disappears almost instantly. On Firefox 57 the warning appears more consistently and stays for longer.

Now here's the back story: It seems Firefox 57 has a lower threshold for what it considers to be a long running script. It's based on the new dom.max_ext_content_script_run_time preference and defaults to 5 seconds. The reason we're seeing this warning is clearly that some of the code in the content script is running for longer than 5 seconds.

There won't be one place in the code where we have this problem. We'll have to identify all the places and do something about it.

I haven't been able to reproduce this issue with the Developer Tools panel closed so I still don't know what part of the code is causing this warning to appear on @lsdornheim's machine. If I had to guess I'd say it has something to do with ElemHideEmulation and the way it responds to DOM mutations. I have also proposed some optimizations in that area.

Last edited 8 weeks ago by mjethani (previous) (diff)

comment:21 Changed 8 weeks ago by mapx

Probably you missed an important part, see https://issues.adblockplus.org/ticket/6067#comment:16

I mean, after getting the warning using 9anime site, I closed the devtools, then go to:
https://en.pons.com/translate?q=test&l=deen&in=&lf=de

I get the same warning error even without devtools.

I close firefox, go again to the same pons page (without devtools opened) and the page loads normally.

So, it's not only the content script runs over 5 seconds but after that there still are consequences. Memory leak ?

comment:22 Changed 8 weeks ago by mjethani

@mapx do you go to pons.com in a new tab or the same tab? If it's a new tab, while you've kept 9anime.is open in the old tab (after closing Developer Tools), you'll still get the warning because the same code is still running.

I closed Developer Tools and went to pons.com in the same tab and was unable to get any warnings.

comment:23 Changed 8 weeks ago by mapx

In the same tab after closing devtools. Every time.

comment:24 Changed 8 weeks ago by mapx

I repeated the test in FF dev edition 58.0b6 (64-bit)

devtools opened, this time I got no warning on the 9anime page. I closed the devtools, I loaded (in the same tab) the pons page above and surprize => I get the warning FF message.

The other old tests were always in FF 58 beta version.

Last edited 8 weeks ago by mapx (previous) (diff)

comment:25 Changed 8 weeks ago by mapx

I repeated the test in dev edition but now when I open devtools I don't go into ABP panel (like before) => no issues anymore.

So, all the trouble is due to the ABP panel ?!

comment:26 Changed 8 weeks ago by mjethani

The ABP panel in Developer Tools is one way to get the warning, but the original issue report does not say anything about opening Developer Tools. This is more fundamental.

I am also getting the warning now sometimes on Facebook, no Developer Tools.

comment:27 Changed 7 weeks ago by rscott

I saw this happen for the first time earlier today on IRCCloud. Platform is FF57/Linux, ABP 3.0.1, Filters: EasyList, EasyPrivacy, Acceptable Ads. EasyPrivacy is out of date and for some reason hasn't been updated since 30 Nov.

The IRCCloud tab showed one item blocked, a Facebook beacon blocked by EasyPrivacy IIRC.

Looking at the output of top, you could see that one of Firefox's "Web Content" child process was maxing out CPU when the warning was popping up. Its memory usage was climbing quite rapidly too, up to about 15GB when I finally killed it, but by then I was using Dev Tools to try & figure out what was going on, which may have affected it as well.

comment:28 Changed 4 weeks ago by fhd

  • Cc trev removed
Note: See TracTickets for help on using tickets.