Dispatching webgl commands from a worker that does not yield to its event loop causes unbound accumulation of shmems
Categories
(Core :: Graphics: CanvasWebGL, defect)
Tracking
()
People
(Reporter: jrmuizel, Assigned: jgilbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
WebGL is currently using RaiiShmem
for transferring command data to the GPU process. This doesn't necessarily work well with DOM workers because it relies on processing received messages to delete the shared memory that it's using.
We run into this problem when using background blur in Zoom and memory usage ends up increasing without bound.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Using ipc::Shmem causes unbounded shmem use growth until e.g. a Worker
yields to the event loop. If a Worker never yields, Shmems sent to WebGLParent
are never released.
Specifically the manager (PCanvasManager) for WebGLParent calls
DestroySharedMemory, which sends/enqueues for WebGLChild's manager a
matching call to ShmemDestroyed. However, while WebGLChild refuses to spin its
event loop (such as a no-return WASM Worker), the ShmemDestroyed events
will just pile up. Closing e.g. the tab frees the shmems, but they accumulate
unbounded until the Worker yields to the event loop.
This is true for other users of ipc::Shmem (or RaiiShmem) as well, but
entrypoints other than DispatchCommands are rarer and can be handled
later similarly.
Comment 3•2 years ago
|
||
Backed out changeset fa04ef087c24 (Bug 1801021) for causing bustages on WebGLChild.cpp and WebGLParent.cpp.
Backout link
Push with failures <--> Bbc
Failure Log
Comment 5•2 years ago
|
||
bugherder |
Assignee | ||
Comment 6•2 years ago
|
||
Comment on attachment 9305056 [details]
Bug 1801021 - Use BigBuffer for DispatchCommands.
Beta/Release Uplift Approval Request
- User impact if declined: Certain use cases (e.g. Zoom background blur) cause unbounded memory allocations until use stops or navigation, which can quickly exhaust system memory.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Medium
- Why is the change risky/not risky? (and alternatives if risky): Not very risky, but we do make changes to both BigBuffer and the allocation for the core mechanism for how WebGL works. We have a lot of webgl tests, but this is load-bearing enough that I don't think it's "low" risk.
- String changes made/needed: none
- Is Android affected?: Yes
Comment 7•2 years ago
|
||
Comment on attachment 9305056 [details]
Bug 1801021 - Use BigBuffer for DispatchCommands.
Approved for 108.0b8
Comment 8•2 years ago
|
||
bugherder uplift |
Comment 9•2 years ago
|
||
== Change summary for alert #36249 (as of Wed, 30 Nov 2022 18:55:34 GMT) ==
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
6% | motionmark_webgl 3DGraphics-WebGL | windows10-64-shippable-qr | e10s fission stylo webgl-ipc webrender | 11.51 -> 12.25 |
6% | glterrain | windows10-64-shippable-qr | e10s fission stylo webgl-ipc webrender | 1.53 -> 1.45 |
5% | motionmark_webgl 3DGraphics-WebGL | windows10-64-shippable-qr | e10s fission stylo webgl-ipc webrender | 11.55 -> 12.17 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=36249
Description
•