Bug 224876 - ASSERTION FAILED: context().isInitialized() ./Modules/webaudio/OfflineAudioDestinationNode.cpp(142)
Summary: ASSERTION FAILED: context().isInitialized() ./Modules/webaudio/OfflineAudioDe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-21 09:54 PDT by Chris Dumez
Modified: 2021-04-21 11:48 PDT (History)
9 users (show)

See Also:


Attachments
Patch (4.99 KB, patch)
2021-04-21 10:15 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.99 KB, patch)
2021-04-21 10:26 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-04-21 09:54:38 PDT
ASSERTION FAILED: context().isInitialized() ./Modules/webaudio/OfflineAudioDestinationNode.cpp(142):
Thread 9 Crashed:: WebCore: AudioWorklet
0   com.apple.JavaScriptCore      	0x0000000747259d3e WTFCrash + 14 (Assertions.cpp:305)
1   com.apple.WebCore             	0x000000072922b87b WTFCrashWithInfo(int, char const*, char const*, int) + 27 (Assertions.h:671)
2   com.apple.WebCore             	0x000000072b6f197f WebCore::OfflineAudioDestinationNode::offlineRender() + 367 (OfflineAudioDestinationNode.cpp:142)
3   com.apple.WebCore             	0x000000072b70c673 WebCore::OfflineAudioDestinationNode::startRendering(WTF::CompletionHandler<void (WTF::Optional<WebCore::Exception>&&)>&&)::$_3::operator()() + 35 (OfflineAudioDestinationNode.cpp:103)
4   com.apple.WebCore             	0x000000072b70c649 WebCore::OfflineAudioDestinationNode::startRendering(WTF::CompletionHandler<void (WTF::Optional<WebCore::Exception>&&)>&&)::$_4::operator()(WebCore::ScriptExecutionContext&) + 25 (OfflineAudioDestinationNode.cpp:124)
5   com.apple.WebCore             	0x000000072b70c5a3 WTF::Detail::CallableWrapper<WebCore::OfflineAudioDestinationNode::startRendering(WTF::CompletionHandler<void (WTF::Optional<WebCore::Exception>&&)>&&)::$_4, void, WebCore::ScriptExecutionContext&>::call(WebCore::ScriptExecutionContext&) + 51 (Function.h:52)
6   com.apple.WebCore             	0x000000072b9bd16a WTF::Function<void (WebCore::ScriptExecutionContext&)>::operator()(WebCore::ScriptExecutionContext&) const + 154 (Function.h:83)
7   com.apple.WebCore             	0x000000072b9a89ad WebCore::ScriptExecutionContext::Task::performTask(WebCore::ScriptExecutionContext&) + 29 (ScriptExecutionContext.h:203)
8   com.apple.WebCore             	0x000000072e13e9d0 WebCore::WorkerRunLoop::Task::performTask(WebCore::WorkerOrWorkletGlobalScope*) + 128 (WorkerRunLoop.cpp:270)
9   com.apple.WebCore             	0x000000072e13e037 WebCore::WorkerRunLoop::runInMode(WebCore::WorkerOrWorkletGlobalScope*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 871 (WorkerRunLoop.cpp:209)
10  com.apple.WebCore             	0x000000072e13d058 WebCore::WorkerRunLoop::run(WebCore::WorkerOrWorkletGlobalScope*) + 88 (WorkerRunLoop.cpp:143)
11  com.apple.WebCore             	0x000000072e13cff8 WebCore::WorkerOrWorkletThread::runEventLoop() + 56 (WorkerOrWorkletThread.cpp:89)
12  com.apple.WebCore             	0x000000072e13d2b0 WebCore::WorkerOrWorkletThread::workerOrWorkletThread() + 544 (WorkerOrWorkletThread.cpp:146)
13  com.apple.WebCore             	0x000000072b6af4ab WebCore::AudioWorkletThread::createThread()::$_7::operator()() const + 27 (AudioWorkletThread.cpp:68)
14  com.apple.WebCore             	0x000000072b6af43e WTF::Detail::CallableWrapper<WebCore::AudioWorkletThread::createThread()::$_7, void>::call() + 30 (Function.h:52)
15  com.apple.JavaScriptCore      	0x0000000747282712 WTF::Function<void ()>::operator()() const + 130 (Function.h:83)
16  com.apple.JavaScriptCore      	0x0000000747338fd8 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 424 (Threading.cpp:183)
17  com.apple.JavaScriptCore      	0x00000007473451a8 WTF::wtfThreadEntryPoint(void*) + 24 (ThreadingPOSIX.cpp:241)
18  libsystem_pthread.dylib       	0x00007fff203868fc _pthread_start + 224
19  libsystem_pthread.dylib       	0x00007fff20382443 thread_start + 15
Comment 1 Chris Dumez 2021-04-21 09:54:47 PDT
<rdar://76896256>
Comment 2 Chris Dumez 2021-04-21 10:15:41 PDT
Created attachment 426707 [details]
Patch
Comment 3 Peng Liu 2021-04-21 10:21:46 PDT
Comment on attachment 426707 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426707&action=review

> Source/WebCore/ChangeLog:12
> +        worket is used, m_renderThread is null and no synchronization with the AudioWorklet

s/worket/worklet/g.

> Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp:86
> +            BinarySemaphore semaphore;

Looks like we can use `callOnMainRunLoopAndWait` here? I mean without the semaphore.
Comment 4 Chris Dumez 2021-04-21 10:24:59 PDT
Comment on attachment 426707 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426707&action=review

>> Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp:86
>> +            BinarySemaphore semaphore;
> 
> Looks like we can use `callOnMainRunLoopAndWait` here? I mean without the semaphore.

No because I am not dispatching to the main RunLoop. I am dispatching to the AudioWorklet thread's RunLoop.
Comment 5 Chris Dumez 2021-04-21 10:26:41 PDT
Created attachment 426710 [details]
Patch
Comment 6 EWS 2021-04-21 11:48:01 PDT
Committed r276379 (236854@main): <https://commits.webkit.org/236854@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426710 [details].