Bug 227728 - [ BigSur Debug ] TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource is flaky, hitting ASSERTION FAILED: !isInRoutingArbitrationForToken(token)
Summary: [ BigSur Debug ] TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMedi...
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-06 16:34 PDT by Eric Hutchison
Modified: 2021-07-22 10:30 PDT (History)
7 users (show)

See Also:


Attachments
Patch (1.64 KB, patch)
2021-07-21 14:49 PDT, Peng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Hutchison 2021-07-06 16:34:27 PDT
TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource

is flaky crashing. Reproduced crash locally on r279579, r279582, r279300.

History: https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource&platform=mac

Crashing with message: ASSERTION FAILED: !isInRoutingArbitrationForToken(token).
Comment 1 Radar WebKit Bug Importer 2021-07-06 16:34:57 PDT
<rdar://problem/80237464>
Comment 2 Ryan Haddad 2021-07-06 16:46:42 PDT
    TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource
        ASSERTION FAILED: !isInRoutingArbitrationForToken(token)
        ./platform/audio/mac/SharedRoutingArbitrator.mm(55) : void WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken(const WebCore::SharedRoutingArbitrator::Token &, AudioSession::CategoryType, WebCore::SharedRoutingArbitrator::ArbitrationCallback &&)
        1   0x1057bc219 WTFCrash
        2   0x121a2bebb WTFCrashWithInfo(int, char const*, char const*, int)
        3   0x1236115f8 WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken(WebCore::SharedRoutingArbitrator::Token const&, WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&)
        4   0x1116d7c19 WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&)
        5   0x1101497f8 void IPC::callMemberFunctionImpl<WebKit::AudioSessionRoutingArbitratorProxy, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&), void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged), std::__1::tuple<WebCore::AudioSession::CategoryType>, 0ul>(WebKit::AudioSessionRoutingArbitratorProxy*, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&), WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&, std::__1::tuple<WebCore::AudioSession::CategoryType>&&, std::__1::integer_sequence<unsigned long, 0ul>)
        6   0x1101471a5 void IPC::callMemberFunction<WebKit::AudioSessionRoutingArbitratorProxy, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&), void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged), std::__1::tuple<WebCore::AudioSession::CategoryType>, std::__1::integer_sequence<unsigned long, 0ul> >(std::__1::tuple<WebCore::AudioSession::CategoryType>&&, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&, WebKit::AudioSessionRoutingArbitratorProxy*, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&))
        7   0x11014527e void IPC::handleMessageAsync<Messages::AudioSessionRoutingArbitratorProxy::BeginRoutingArbitrationWithCategory, WebKit::AudioSessionRoutingArbitratorProxy, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&)>(IPC::Connection&, IPC::Decoder&, WebKit::AudioSessionRoutingArbitratorProxy*, void (WebKit::AudioSessionRoutingArbitratorProxy::*)(WebCore::AudioSession::CategoryType, WTF::CompletionHandler<void (WebCore::AudioSessionRoutingArbitrationClient::RoutingArbitrationError, WebCore::AudioSessionRoutingArbitrationClient::DefaultRouteChanged)>&&))
        8   0x110145047 WebKit::AudioSessionRoutingArbitratorProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)

https://build.webkit.org/#/builders/3/builds/3018/steps/12/logs/stdio
Comment 3 Peng Liu 2021-07-07 15:28:49 PDT
Currently, three processes are involved to begin routing arbitration.

WebContent process:
HTMLMediaElement changes state (canProduceAudioChanged)
MediaSessionManagerCocoa sets the category of RemoteAudioSession, which sends an IPC message(RemoteAudioSessionProxy::SetCategory) to the GPU Process.

GPU Process:
3. RemoteAudioSessionProxy starts the process to set the category of AudioSessionMac, which will call LocalAudioSessionRoutingArbitrator to send an IPC message (GPUProcessConnection::BeginRoutingArbitrationWithCategory) to the WebContent process.

WebContent Process:
4. Send an IPC message (AudioSessionRoutingArbitratorProxy::BeginRoutingArbitrationWithCategory) to the UI process.

UI Process:
5. Call SharedRoutingArbitrator::beginRoutingArbitrationWithCategoryForToken().


After the GPU Process crashes,

WebContent Process:
6. Reload and resume the media playback. This will lead to the state change in step 1, after that step 2, 3, 4, 5 will run again.

UI Process:
7. Clean up routing arbitrator by calling SharedRoutingArbitrator::endRoutingArbitrationForToken().


Normally, step 6 and 7 happen almost at the same time (in different processes). Step 7 will be done before steps 1, 2, 3, 4, and 5 which are triggered by step 6. However, that is not guaranteed. If step 7 is delayed for some reason, step 5 will crash with an assertion failure.
Comment 4 Alexey Proskuryakov 2021-07-12 19:45:04 PDT
This keeps happening super frequently, roughly half of the time. Seems like the test should be removed if it cannot be fixed soon.
Comment 5 Peng Liu 2021-07-12 20:21:43 PDT
(In reply to Alexey Proskuryakov from comment #4)
> This keeps happening super frequently, roughly half of the time. Seems like
> the test should be removed if it cannot be fixed soon.

Agree. I think it is a good idea to disable the test for now.
Comment 6 Peng Liu 2021-07-21 14:49:11 PDT
Created attachment 433960 [details]
Patch
Comment 7 EWS 2021-07-22 10:29:06 PDT
Committed r280180 (239874@main): <https://commits.webkit.org/239874@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 433960 [details].
Comment 8 Peng Liu 2021-07-22 10:30:03 PDT
Reopen this bug because the issue is not resolved.