Closed Bug 1811755 Opened 2 years ago Closed 5 months ago

Running a particular demo with the profiler leads to exponential memory use, OOM and crash

Categories

(Core :: Gecko Profiler, defect, P2)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mayankleoboy1, Unassigned)

References

(Depends on 1 open bug, )

Details

Crash Data

Attachments

(3 files)

Attached file Look at PID 4824

Go to https://www.fxhash.xyz/generative/10872
Enable the profiler (i use the "Graphics" preset)
On the demo page, click on "run"

AR: Immediate exponential memory use. Browser will OOM in a few seconds

Attached file Look at PID 35484
Crash Signature: [@ OOM | large | mozalloc_abort | moz_xmalloc | new[] | mozilla::MakeUnique ]
Attached file about:support
Summary: Running a particular demo with the profiler leads to exponential memory use and eventual OOM → Running a particular demo with the profiler leads to exponential memory use, OOM and crash

I tested this bug on a build from 2021-Jan, and could repro. So this is not a recent regression.

Comment on attachment 9313460 [details]
Look at PID 35484

This is an about:memory report showing:

7,254.94 MB (100.0%) -- explicit
├──7,073.41 MB (97.50%) ── heap-unclassified
├─────99.20 MB (01.37%) -- heap-overhead
│     ├──94.55 MB (01.30%) ── bookkeeping
│     └───4.64 MB (00.06%) ++ (3 tiny)
└─────82.33 MB (01.13%) ++ (24 tiny)

I can reproduce, here's a profile of it: https://share.firefox.dev/3kuZ21D
I think the problem here is that the profiler allocates a buffer chunk every time Window.setTimeout is called to record the stack that created the timer.

In my case, about:memory showed:

6,802.45 MB (100.0%) -- explicit
├──6,450.99 MB (94.83%) ── heap-unclassified
├────269.64 MB (03.96%) -- heap-overhead
│    ├──256.51 MB (03.77%) ── bookkeeping
│    └───13.13 MB (00.19%) ++ (3 tiny)
└─────81.81 MB (01.20%) ++ (24 tiny)

(In reply to Mayank Bansal from comment #0)

AR: Immediate exponential memory use. Browser will OOM in a few seconds

I can't reproduce the OOM crash, and the memory use isn't exponential: it quickly grows to 8GB (the size of profiler buffer chunks allocated when lots of setTimeout calls are made at the beginning of the demo) and then slowly shrinks as timers fire. Here's a profile where I kept the demo running for longer where half of the memory was already freed within a minute: https://share.firefox.dev/3iW5RsC

Something else that's concerning is that it seems all these profiler buffers are not freed when the profiler is stopped, only when the timers fire.

Looks like a significant issue, thanks for filing. I agree what Florian said. It looks like because of the excessive stacks that are being captured for markers. Filed Bug 1811807 for this issue specifically.

(In reply to Florian Quèze [:florian] from comment #6)

Something else that's concerning is that it seems all these profiler buffers are not freed when the profiler is stopped, only when the timers fire.

Yeah, I don't think we have a way to free all the stacks when the profiler stops. That's another reason to use our main buffer instead of these small ones.

Severity: -- → S3
Priority: -- → P2
Duplicate of this bug: 1817906
Depends on: 1814908

Closing because no crashes reported for 12 weeks.

Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: