Open Bug 1916236 Opened 1 year ago Updated 1 year ago

alerabat extension uses gigabytes of memory through StructuredCloneHolder in the extension process

Categories

(WebExtensions :: General, defect, P3)

Firefox 128
defect

Tracking

(Not tracked)

People

(Reporter: dawid.najgiebauer, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Steps to reproduce:

In about:processes the Extensions item show a large amount of RAM - over 6GB. Firefox can allocate all of free memory in system.
The memory will free only if I manually run GC or add/remove any extension.

In 115 ESR it's be self free if consume maximum 3GB.

Actual results:

System can crash, because no free memory left.

Expected results:

Fired garbage collector automatically if here is no free RAM left.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

Could you capture a memory report at about:memory and share it here?

Flags: needinfo?(dawid.najgiebauer)
Attached file Memory report
Here
Flags: needinfo?(dawid.najgiebauer)

When I open the attached files in about:memory, I see the following entries under the extension process section. These entries are associated with this add-on that you have installed: https://addons.mozilla.org/en-US/firefox/addon/alerabat-kupony-kody-rabatowe/

If you remove or disable this extension, your performance issue will probably be resolved. Can you confirm whether this helps?

8,101,155,104 B (100.0%) -- explicit
├──7,997,614,000 B (98.72%) -- dom
│  ├──7,997,612,688 B (98.72%) -- structured-clone-holder
│  │  ├──7,995,831,712 B (98.70%) ── Messenger/{6c0839b6-2697-49ca-ac8c-8c65a8d9b7b9}/sendRuntimeMessage [935]
7,120,983,904 B (100.0%) -- explicit
├──6,727,745,088 B (94.48%) -- dom
│  ├──6,727,743,776 B (94.48%) -- structured-clone-holder
│  │  ├──6,709,203,808 B (94.22%) -- Messenger
│  │  │  ├──6,707,340,320 B (94.19%) ── {6c0839b6-2697-49ca-ac8c-8c65a8d9b7b9}/sendRuntimeMessage [2389]

Additional analysis:

Flags: needinfo?(dawid.najgiebauer)

I confirm (now tested on 128.2) that is probability source of the problems - after disable this, memory usage does not increase as much.

There are two questions that may help in the investigation:

  1. Why in previously ESR Firefox not consume so large amount of RAM?
  2. Why, after manually execute GC, memory usage drops down?

Thanks for your help so far! If you need anything, please feel free to contact me.

Flags: needinfo?(dawid.najgiebauer)

(In reply to dzyszla from comment #6)

I confirm (now tested on 128.2) that is probability source of the problems - after disable this, memory usage does not increase as much.

There are two questions that may help in the investigation:

  1. Why in previously ESR Firefox not consume so large amount of RAM?

It is likely not specific to ESR versions. The add-on was updated last month, on August 6th. It is possible that the regression was introduced in a recent version. I recommend reporting this issue with the add-on author.

  1. Why, after manually execute GC, memory usage drops down?

How did you draw this conclusion? Could you share the about:memory report before and after forcing GC?

Thanks for your help so far! If you need anything, please feel free to contact me.

Firefox Nightly includes a memory profiler. Since the issue is likely specific to the add-on, could you try enabling the profiler at https://profiler.firefox.com/ , starting a profile, doing your regular browsing (ideally without sensitive activity), and share the profile? This would enable me to see what exactly contributes to the memory increase.

I attached report just before and just after click GC on about:memory page.

I'm not sure, what exactly should I do with profiler - Will I install nightly version? The profiler is available in regular too, and can click near the 'extensions' position on about:processes - isn't that enough?

After reading the comments I will change the status from Unconfirmed to New, waiting for a resolution related to before/after GC call.

Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to dzyszla from comment #10)

I attached report just before and just after click GC on about:memory page.

I'm not sure, what exactly should I do with profiler - Will I install nightly version? The profiler is available in regular too, and can click near the 'extensions' position on about:processes - isn't that enough?

You can enable the profiler on a regular release Firefox version, from this website https://profiler.firefox.com/ click on the "Enable Firefox Profiler Menu Button" make it to appear.

Then you can start to record a profile before the issue is hit and then stop a little bit after the menory usage did grow. When you stop the profiler it will open a new tab to the profiler webapp UI and you can get a shareable link to that profile from there.

Flags: needinfo?(dawid.najgiebauer)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #12)

(...) before the issue is hit and then stop a little bit after the menory usage did grow
But it is not one moment. Usage grows systematically and all the time until I either call GC itself or enable/disable any(!) extension (probably this forces GC?). So, how to make measuring best way?

Flags: needinfo?(dawid.najgiebauer)

Sorry, quote marking mistake. One more time my question:

But it is not one moment. Usage grows systematically and all the time until I either call GC itself or enable/disable any(!) extension (probably this forces GC?). So, how to make measuring best way?

The profiler uses a circular buffer, so you can record a period of time while interacting with the browser in a way that usually results in the memory growth, then trigger GC and stop the recording shortly after to capture it for sharing. Ideally the profile would show the activity from the extension that over time results in excessive memory usage.

Blocks: webext-perf
Severity: -- → S4
Component: Untriaged → General
Priority: -- → P3
Summary: 128 ESR - Extensions consumes too much RAM → alerabat extension uses gigabytes of memory through StructuredCloneHolder in the extension process
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: