You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[wpe-2.38] <video> element is never destoyed when using modern media controls #1285
We observe increased memory consumption for wpe webkit 2.38 (comparing to 2.28) when running YT cert tests. It sometimes leads to OOM killer as WPEWebProcess uses ~550MB of memory despite much lower memory pressure settings.
YT creates separete <video> element for each test. Initial analysis shows that HTMLMediaElement (s) are never destroyed during execution. Also manually triggering GarbageCollector from RWI doesn't help, nothing is destoryd.
Together with HTMLMediaElement there are many other objects that are connected, like SourceBuffers, MediaKeys, etc. As a result memory usage is growing constantly triggering OOM eventually.
Looking into JS sources it looks like enabling video controls attribute is the reason here. When media controls are disabled then issue is not observed. With 2.38 media controls impl changed -> modern media controls was enabled that seems to be the reason here.
Here is a javascript code that reproduces the issue. I use "collect garbage" button from RWI to trigger GC and check if ~HTMLMediaElement() is called:
var vid;
var ms;
function test() {
vid = document.createElement("video");
document.body.appendChild(vid);
vid.controls = true;
ms = new MediaSource;
ms.addEventListener('sourceopen', function(e) {
vid.pause();
URL.revokeObjectURL(vid.src);
vid.src = '';
vid.removeAttribute('src');
vid.load();
vid.parentNode.removeChild(vid);
vid = null;
ms = null;
});
vid.src = URL.createObjectURL(ms);
}
Note that skipping video.controls(true) or not attaching video element into document's body works perfectly fine.
Tested with the latest webkit build and all my cases work fine now. HTMLMediaElement is correctly destroyed.
Also YT cert tests look much better now.
Thanks @eocanha
Activity
eocanha commentedon Mar 8, 2024
Fix patch submitted upstream for review as https://bugs.webkit.org/show_bug.cgi?id=270571 / WebKit/WebKit#25625.
[Modern Media Controls] HTMLMediaElement is never destoyed when showi…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
Cherry-pick 277196@main (80dd62a). https://bugs.webkit.org/show_bug.c…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
eocanha commentedon Apr 10, 2024
The patch landed upstream as WebKit/WebKit@80dd62a and was backported to wpe-2.38 as 7877902.
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
eocanha commentedon Apr 11, 2024
...and to the calvaris/wpe-2.42/upstream branch as 6de0ae1. Closing Issue.
asurdej-comcast commentedon Apr 15, 2024
Tested with the latest webkit build and all my cases work fine now. HTMLMediaElement is correctly destroyed.
Also YT cert tests look much better now.
Thanks @eocanha
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…
[Modern Media Controls] HTMLMediaElement is never destroyed when show…