Bug 270894 - [MSE in Worker] ASSERT(canSafelyBeUsed());
Summary: [MSE in Worker] ASSERT(canSafelyBeUsed());
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks: 264134
  Show dependency treegraph
 
Reported: 2024-03-12 20:39 PDT by Jean-Yves Avenard [:jya]
Modified: 2024-03-14 10:14 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2024-03-12 20:39:25 PDT
running https://jyavenard.github.io/mse-in-workers-demo/mse-in-workers-demo.html can cause an assertion when clicking on "stop" button while playback is running.

```
* thread #12, name = 'WebCore: Worker', stop reason = EXC_BAD_ACCESS (code=1, address=0xbbadbeef)
    frame #0: 0x000000013b3155d8 JavaScriptCore`::WTFCrash() at Assertions.cpp:351:35
    frame #1: 0x0000000303596fb4 WebCore`WTFCrashWithInfo((null)=110, (null)="/Users/jyavenard/Work/webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/WeakPtr.h", (null)="T *WTF::WeakPtr<WebCore::HTMLMediaElement>::operator->() const [T = WebCore::HTMLMediaElement, WeakPtrImpl = WTF::DefaultWeakPtrImpl, PtrTraits = WTF::RawPtrTraits<WTF::DefaultWeakPtrImpl>]", (null)=323) at Assertions.h:780:5
    frame #2: 0x0000000302c495a0 WebCore`WTF::WeakPtr<WebCore::HTMLMediaElement, WTF::DefaultWeakPtrImpl, WTF::RawPtrTraits<WTF::DefaultWeakPtrImpl>>::operator->(this=0x00000001160525b0) const at WeakPtr.h:110:9
  * frame #3: 0x0000000302c95f74 WebCore`WebCore::MediaSource::stop(this=0x0000000116052520) at MediaSource.cpp:1254:9
    frame #4: 0x00000003041ee52c WebCore`auto WebCore::ScriptExecutionContext::stopActiveDOMObjects()::$_9::operator()<WebCore::ActiveDOMObject>(this=0x0000000113abc2f8, activeDOMObject=0x0000000116052520) const at ScriptExecutionContext.cpp:396:25
    frame #5: 0x00000003041ee4a8 WebCore`WTF::Detail::CallableWrapper<WebCore::ScriptExecutionContext::stopActiveDOMObjects()::$_9, WebCore::ScriptExecutionContext::ShouldContinue, WebCore::ActiveDOMObject&>::call(this=0x0000000113abc2f0, in=0x0000000116052520) at Function.h:53:39
    frame #6: 0x00000003041cbe38 WebCore`WTF::Function<WebCore::ScriptExecutionContext::ShouldContinue (WebCore::ActiveDOMObject&)>::operator()(this=0x000000016fd52ab0, in=0x0000000116052520) const at Function.h:82:35
    frame #7: 0x00000003041cbc68 WebCore`WebCore::ScriptExecutionContext::forEachActiveDOMObject(this=0x0000000116042b20, apply=0x000000016fd52ab0) const at ScriptExecutionContext.cpp:301:13
    frame #8: 0x00000003041cc5c4 WebCore`WebCore::ScriptExecutionContext::stopActiveDOMObjects(this=0x0000000116042b20) at ScriptExecutionContext.cpp:395:5
    frame #9: 0x0000000306612524 WebCore`WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction(this=0x0000000116042b20) at WorkerOrWorkletGlobalScope.cpp:65:5
    frame #10: 0x0000000306612358 WebCore`WebCore::WorkerGlobalScope::prepareForDestruction(this=0x0000000116042b20) at WorkerGlobalScope.cpp:159:33
    frame #11: 0x00000003065fabc0 WebCore`WebCore::DedicatedWorkerGlobalScope::prepareForDestruction(this=0x0000000116042b20) at DedicatedWorkerGlobalScope.cpp:89:24
    frame #12: 0x000000030665fdf8 WebCore`WebCore::WorkerOrWorkletThread::stop(WTF::Function<void ()>&&)::$_7::operator()(this=0x0000000113cb88a8, context=0x0000000116042b20) const at WorkerOrWorkletThread.cpp:302:25
    frame #13: 0x000000030665fd64 WebCore`WTF::Detail::CallableWrapper<WebCore::WorkerOrWorkletThread::stop(WTF::Function<void ()>&&)::$_7, void, WebCore::ScriptExecutionContext&>::call(this=0x0000000113cb88a0, in=0x0000000116042b20) at Function.h:53:39
    frame #14: 0x00000003027f32a4 WebCore`WTF::Function<void (WebCore::ScriptExecutionContext&)>::operator()(this=0x0000000113c21280, in=0x0000000116042b20) const at Function.h:82:35
    frame #15: 0x00000003031c2868 WebCore`WebCore::ScriptExecutionContext::Task::performTask(this=0x0000000113c21280, context=0x0000000116042b20) at ScriptExecutionContext.h:233:61
    frame #16: 0x000000030664af64 WebCore`WebCore::WorkerDedicatedRunLoop::Task::performTask(this=0x0000000113c21280, context=0x0000000116042b20) at WorkerRunLoop.cpp:285:16
    frame #17: 0x000000030664a6fc WebCore`WebCore::WorkerDedicatedRunLoop::runCleanupTasks(this=0x00000001133cbba0, context=0x0000000116042b20) at WorkerRunLoop.cpp:253:15
    frame #18: 0x000000030664886c WebCore`WebCore::WorkerDedicatedRunLoop::run(this=0x00000001133cbba0, context=0x0000000116042b20) at WorkerRunLoop.cpp:158:5
    frame #19: 0x0000000306648774 WebCore`WebCore::WorkerOrWorkletThread::runEventLoop(this=0x0000000113294100) at WorkerOrWorkletThread.cpp:113:18
    frame #20: 0x0000000306648c40 WebCore`WebCore::WorkerOrWorkletThread::workerOrWorkletThread(this=0x0000000113294100) at WorkerOrWorkletThread.cpp:187:5
    frame #21: 0x000000030666e4f8 WebCore`WebCore::WorkerThread::createThread()::$_18::operator()(this=0x00000001135a6868) const at WorkerThread.cpp:127:9
    frame #22: 0x000000030666e49c WebCore`WTF::Detail::CallableWrapper<WebCore::WorkerThread::createThread()::$_18, void>::call(this=0x00000001135a6860) at Function.h:53:39
    frame #23: 0x000000013d2533dc JavaScriptCore`WTF::Function<void ()>::operator()(this=0x000000016fd52f90) const at Function.h:82:35
    frame #24: 0x000000013b445bbc JavaScriptCore`WTF::Thread::entryPoint(newThreadContext=0x000000011385ab80) at Threading.cpp:258:5
    frame #25: 0x000000013b452e14 JavaScriptCore`WTF::wtfThreadEntryPoint(context=0x000000011385ab80) at ThreadingPOSIX.cpp:247:5
    frame #26: 0x000000019d4faf94 libsystem_pthread.dylib`_pthread_start + 136
```
Comment 1 Radar WebKit Bug Importer 2024-03-12 20:40:36 PDT
<rdar://problem/124500515>
Comment 2 Jean-Yves Avenard [:jya] 2024-03-12 20:47:29 PDT
Pull request: https://github.com/WebKit/WebKit/pull/25806
Comment 3 EWS 2024-03-14 10:14:57 PDT
Committed 276100@main (dd8b32e43a1a): <https://commits.webkit.org/276100@main>

Reviewed commits have been landed. Closing PR #25806 and removing active labels.