Open Bug 1888994 Opened 1 year ago Updated 8 months ago

https://basicpitch.spotify.com/ has exponential memory increase in the content process and parent process while playing a midi file that will cause the browser to crash

Categories

(Core :: DOM: File, defect, P2)

Firefox 124
defect

Tracking

()

REOPENED

People

(Reporter: firefox, Unassigned)

Details

(Whiteboard: dom-lws-bugdash-triage)

Attachments

(5 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0

Steps to reproduce:

Go to https://basicpitch.spotify.com/
Upload some random mp3
Wait
Play MIDI in the browser

Actual results:

High CPU, high memory use, tab crashes

kernel: [54102.898343] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=php8.3-fpm.service,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/app.slice/app-firefox-63920b14a404496cbf0df4e89e747af8.scope,task=Isolated Web Co,pid=122092,uid=1000
Apr 2 00:08:36 kernel: [54102.898428] Out of memory: Killed process 122092 (Isolated Web Co) total-vm:19009680kB, anon-rss:11853540kB, file-rss:300kB, shmem-rss:65064kB, UID:1000 pgtables:25128kB oom_score_adj:100
Apr 2 00:08:36 systemd[2496]: app-firefox-63920b14a404496cbf0df4e89e747af8.scope: A process of this unit has been killed by the OOM killer.

Expected results:

MIDI played

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

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Can confirm.
As soon as you start to play the midi, the memory rises exponentially and you get a OOM.
FWIW, Chrome also has increase in memory. BUT, A)increase is slower, B)only the content process has memory increase, C)If you put the tab in background, the memory decreases

Status: UNCONFIRMED → NEW
Component: Widget: Gtk → Audio/Video
Ever confirmed: true
Flags: needinfo?(padenot)

https://share.firefox.dev/3PMRqo9
Profile with media playback preset logging.

Attached file memory-report.json.gz

The website is weird. First, to analyze a simple .wav file it uses tons of GPU and then tons of CPU. Then when it does convert the file into midi, tthe playback immediately increases the memory.

Attached file Even larger memory use
Summary: Firefox tab (tab! not browser) crashing on playing MIDI at https://basicpitch.spotify.com/ → https://basicpitch.spotify.com/ has exponential memory increase in the content process and parent process while playing a midi file that will cause the browser to crash
Attached file about:support
Attached audio onara.wav

media preset logging. But I dont think for some reason the log only captured a small bit.

This website plays audio, but the CPU and memory usage isn't media related, redirecting. Thanks for the analysis and profile!

This looks like inefficiencies related to Blob.

Component: Audio/Video → DOM: Performance
Flags: needinfo?(padenot)
Component: DOM: Performance → DOM: File

Thanks for gathering the memory reports, Mayank.

From the main process:

3,633.97 MB (100.0%) -- explicit
├──3,353.99 MB (92.30%) ── heap-unclassified

From the spotify process:

3,642.03 MB (100.0%) -- explicit
├──3,304.99 MB (90.75%) -- dom
│ ├──3,304.99 MB (90.75%) -- memory-file-data
│ │ ├──3,304.99 MB (90.75%) ── large/file(length=34311152, sha1=9f9d90a1c430be5fd166c861e53e348d2605face) [101]

The [101] means there were 101 entries with that exact path, so it looks like we're leaking a bunch of copies of something.

Severity: -- → S3
Priority: -- → P2

It's quite possible this isn't a leak but rather a difference in the situation in which we will spill a Blob/File to disk to be disk-backed instead of memory-backed. If content does new Blob/File and hands us a string/array/anything that isn't already a Blob, we just leave the underlying storage as memory-backed, whereas I believe Chrome will potentially spill to disk more aggressively in this case. (I believe we spill to disk currently only at minting time only in a few cases (uses diagram).)

Whiteboard: dom-lws-bugdash-triage

Seems to be fixed in v137.0.1

(In reply to Daniel from comment #14)

Seems to be fixed in v137.0.1

Thank you for checking! We probably cannot really know if the site changed or we really fixed this, but WFM sounds right then.

Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → WORKSFORME

I can still repro.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: