mgziminsky / FacebookTrackingRemoval

Browser extension that removes ads and the user interaction tracking from content on Facebook
GNU General Public License v3.0
121 stars 19 forks source link

Very high CPU usage to the point of freezing Chrome #53

Closed LosD closed 2 years ago

LosD commented 2 years ago

Describe the bug I'm seeing very high CPU usage from Facebook with the extension active, especially after clicking images. As it opens, all browser windows freezes for 4-5 seconds. If I disable the extension, it stops (okay, CPU usage is still rather high, it is Facebook after all, but not surprisingly high). It seems to do the same as you close the image.

To Reproduce Steps to reproduce the behavior:

  1. Open Chrome's Task Manager, sorted by CPU usage.
  2. Open Facebook, watch it shoot to 100+% CPU usage.
  3. Click on an image.
  4. Freezing

Expected behavior "Normal" CPU usage, no freezing.

Screenshots If applicable, add screenshots to help explain your problem.

Please provide the following information:

Additional context I think it started a month or so ago. Not sure if it was ~an extension or~ a Chrome update or Facebook change that started it

Edit: Just checked version history. Definitely not an extension update

mgziminsky commented 2 years ago

Sorry, I can't seem to reproduce. Do you have any other extensions installed that could be conflicting with this one?

If you wanted to try investigating a bit more thoroughly on your end, you can run the profiler built into the developer tools (Performance tab) and look at the bottom up view to see if anything stands out. Here is the result of a 30 sec capture on my end including clicking images and heavy scrolling to load in content:

image

LosD commented 2 years ago

Well I DO have a gazillion extensions installed, so can't quite say that there isn't.

Took a trace, and the culprit seems to be a pointerover event handler: image

LosD commented 2 years ago

It seems to disappear if I disable "Remove tracking from external links".

mgziminsky commented 2 years ago

Sounds to me like it is most likely a conflict with another extension. My best guess is that you have another extension that is also monitoring and modifying the href of links, so this extension and the other one are causing an infinite loop between each other. If you change the profiling view to "Group by Domain" it may show you the source of the pointerover event calls, since I don't use that event in this extension.

As a final check that it is a conflict, would you be able try running chrome with only this extension enabled and see if it is still broken? If it is still broken by itself, then I'll look into it more. But if it works, then there isn't much I can do.

LosD commented 2 years ago

That's fair. I disabled other extensions, but unfortunately it didn't really help.

Here's the new profile without extensions: image

Here it is grouped by domain. I opened the extension so you can see what is most active: image

It looks like it is Facebook being triggered to do, errrr ... something... I checked inside "unattributed", and it all seems to be scripts from fbcdn.

mgziminsky commented 2 years ago

Sorry, I'm not sure there's anything I can do.. I didn't look at your profiler times initially, but looking now, even your original run looks totally normal. Depending how long the capture was, those Self/Total times are actually completely normal, so whatever is going on isn't getting picked up by the profiler.

As a way of tracking link interaction, FB updates certain links when it detects the mouse on the link, and that is my best guess as to what is causing the pointerover event. If FB is changing the link, then the extension is changing it back, and then FB again, and so on... that could be causing the lockups you are seeing. I try to fix such links and disable the FB script ahead of time, but if that's not working for some reason, I could imagine this sort of issue.

All of that is just an educated guess though. Since I'm unable to reproduce the issue on my end, there is no easy way for me to investigate more thoroughly :/

LosD commented 2 years ago

The run is only from opening an image and closing them again. So maybe 6-7 seconds including the browser being frozen. Scripts running for half that time hardly seems normal to me?

Oh well, if you can't reproduce, you can't reproduce, that's how it is sometimes. Do you want me to leave it open, or should I just close it?

mgziminsky commented 2 years ago

Let's leave this open for now. There are a couple other things i'd be curious to know if you wanted to take the time:

LosD commented 2 years ago

I'll close it.... Just noticed Facebook doing it all by itself with the extension disabled. Somehow it happens faster with the extension, but the root cause seems to be Facebook (or Chrome, Firefox seems to handle it much better), I just need to scroll further before it starts to happen.

Sorry for wasting your time! :(