AdguardTeam / AdguardBrowserExtension

AdGuard browser extension
https://adguard.com/
GNU General Public License v3.0
3.15k stars 336 forks source link

In some case it is causing the memory usage to bloat. #2445

Open kodiakhub opened 1 year ago

kodiakhub commented 1 year ago

AdGuard Extension version

4.2.151

Browser version

116.0.5845.97 (Official Build) (64-bit)

OS version

Windows 10

What filters do you have enabled?

AdGuard Base filter, AdGuard Turkish filter, AdGuard Tracking Protection filter, AdGuard URL Tracking filter, AdGuard Social Media filter, AdGuard Annoyances filter

What Stealth Mode options do you have enabled?

Disabled

Issue Details

By the way, I don't know how the site crashed and the AdGuard extension stopped responding (When up to 800k memory usage).

Check the 1st video for more information.

Expected Behavior

The memory usage as like in the uBO extension works normally. Check the 2nd video.

uBO settings ``` uBlock Origin: 1.51.0 Chromium: 116 filterset (summary): network: 137343 cosmetic: 167385 scriptlet: 41321 html: 0 listset (total-discarded, last-updated): removed: easyprivacy: null plowe-0: null urlhaus-1: null added: TUR-0: 13716-11, now adguard-cookies: 26665-29, now adguard-generic: 73054-471, now adguard-mobile-app-banners: 4516-9, now adguard-other-annoyances: 13287-7, now adguard-popup-overlays: 23331-70, now adguard-social: 21236-909, now adguard-spyware: 55986-1332, now adguard-spyware-url: 1191-3, now adguard-widgets: 2278-5, now ublock-annoyances: 5385-205, now ublock-cookies-adguard: 266-266, now default: user-filters: 0-0, never easylist: 69700-1097, now ublock-badware: 7749-362, now ublock-filters: 34339-4199, now ublock-privacy: 534-129, now ublock-quick-fixes: 286-109, now ublock-unbreak: 2115-138, now filterset (user): [empty] userSettings: contextMenuEnabled: false showIconBadge: false hiddenSettings: [none] supportStats: allReadyAfter: 357 ms (selfie) maxAssetCacheWait: 275 ms ```

Videos

Video 1 https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/4173d5e1-3f1b-4ef7-92a4-ac1bd34ee0a6
Video 2 https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/92b3fb23-4873-4827-aa97-5e81057160da

Additional Information

When you process continuously as like in the 1st video, such spam occurs in the filtering logs.

Screenshot ![image](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/7bff7803-7eb7-4faf-b5e3-b154bcc4630f)
ameshkov commented 1 year ago

@kodiakhub does it only happen when the filtering log is open?

kodiakhub commented 1 year ago

@kodiakhub does it only happen when the filtering log is open?

No, the "Filtering log" wasn't on when I first reported it and it would appear that the "Filtering log" tab was opened in the browser task manager. By the way, I tested again with v4.2.159 beta extension with the "Filtering log" turned on and this is the result:

Screenshot ![image](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/91391535-d191-4e9f-8c7b-685dd2cf8bc4)

Meanwhile, the extension is starting to lag and transaction processes are becoming slowly. (After 400-600k Memory footprints.)

ameshkov commented 1 year ago

Well, filtering log could explain this behavior, for instance the number of events in the log could've been growing indefinitely.

If the issue is reproducible without filtering log, this is a completely different story though.

kodiakhub commented 1 year ago

If the issue is reproducible without filtering log, this is a completely different story though.

So, can we say that there are two different problems here? If so, I hope both issues are resolved. 👍 Because in the uBO extension there is no such problem in both issue.

Screenshot ![image](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/973569bb-2e2a-40c9-b7f9-219454298b05)
kodiakhub commented 1 year ago

This is how it's crashed: More videos content in one page > More filtering logs > Overloaded > Crashed. (Ofc, with the "Filtering log" is on)

https://www.izle7.com/kanal7/kategori/emanet

Screenshots ![F](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/b28a3dbb-eb4a-4ce5-a234-4418c5b3979b) ![FF](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/64649bdc-d29c-47a3-960e-73dfe7b2d485) ![FFF](https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/7d3a91fd-f759-4d2a-8db8-19ef7b1cf7f8)

Also on such pages there are lags in the extension v1.2.162 even when "Filtering log" is not turned on. For example, clicking the extension icon gives full response after 20 seconds.

Videos https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/828bb0d6-92be-4b6c-9b9e-71ba88987722 https://github.com/AdguardTeam/AdguardBrowserExtension/assets/56846906/1feb00c9-5d2d-4e69-88d4-c4ceffab1403

Hope the more info helps. 👍

stanislav-atr commented 1 year ago

@kodiakhub It seems that such memory consumption is not caused by some anomaly, but by the website frequently reloading it's iframes, possibly due to some antiadblock feature. As a result, the extension injects lot of cosmetic rules into these frames, thus ramping up memory usage.

kodiakhub commented 1 year ago

As a result, the extension injects lot of cosmetic rules into these frames, thus ramping up memory usage.

@stanislav-atr it may useful to inform: This issue is not only on this site. I can slightly notice that there are delays both in the AdGuard extension and in other sites with certain conditions. But it is not as big of a problem as the site issue here. 👍