Bug 215165

Summary: [iOS 14] WebKit::WebPage's constructor hangs for 25 seconds on simulator
Product: WebKit Reporter: Ali Juma <ajuma>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap, beidson, justincohen, rohitrao, ryanhaddad
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Ali Juma 2020-08-05 06:41:13 PDT
Starting in iOS 14 beta 3 (and also in beta 4), each call to WebKit::WebPage's constructor hangs on the simulator for 25 seconds. This happens in any app embedding a WKWebView, including Safari.

The stack is below. The root cause seems to be the call to [AVAudioSession sharedInstance].

#0	0x00000002803376d8 in HALCADClient::ConnectToServer() ()
#1	0x0000000280304447 in HALSystem::InitializeDevices() ()
#2	0x0000000280303753 in HALSystem::CheckOutInstance() ()
#3	0x00000002803032f1 in AudioObjectGetPropertyData ()
#4	0x00000002a9af6d8b in SimulatorDeviceSettings::GetDeviceIDFromUID_Priv(__CFString const*) ()
#5	0x00000002a9af677a in SimulatorDeviceSettings::SimulatorReadHardwareSettingsFromURL_Priv(__CFURL const*) ()
#6	0x00000002a9af6fcc in SimulatorDeviceSettings::SimulatorDeviceSettings(applesauce::dispatch::v1::queue, void () block_pointer) ()
#7	0x00000002a9af7967 in invocation function for block in AudioSessionClientManager::Instance() ()
#8	0x000000027e304bb6 in _dispatch_client_callout ()
#9	0x000000027e306121 in _dispatch_once_callout ()
#10	0x00000002a9b23266 in invocation function for block in AudioSessionClientManager::CreatePrimaryClient(__CFRunLoop*, __CFString const*, void (*)(void*, unsigned int), void*) ()
#11	0x000000027e304bb6 in _dispatch_client_callout ()
#12	0x000000027e313dd9 in _dispatch_lane_barrier_sync_invoke_and_complete ()
#13	0x00000002a9b22a63 in AudioSessionCreateSession_Priv ()
#14	0x00000002b733d96e in avfaudio::SessionConnector::Connect(AVAudioSession*, applesauce::CF::ObjectRef<__CFRunLoop*>, AudioSessionType) ()
#15	0x00000002b7334c7a in -[AVAudioSession initWithSessionType:] ()
#16	0x00000002b73350de in __32+[AVAudioSession sharedInstance]_block_invoke ()
#17	0x000000027e304bb6 in _dispatch_client_callout ()
#18	0x000000027e306121 in _dispatch_once_callout ()
#19	0x00000002b733509b in +[AVAudioSession sharedInstance] ()
#20	0x000000028b9b9053 in -[WebCoreAudioCaptureSourceIOSListener initWithCallback:] at /Users/ajuma/syncWebKit/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:57
#21	0x000000028b9b922f in WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS() at /Users/ajuma/syncWebKit/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:87
#22	0x000000028b9b9405 in WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS() at /Users/ajuma/syncWebKit/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:88
#23	0x000000028b9ba8ce in WTF::NeverDestroyed<WebCore::CoreAudioCaptureSourceFactoryIOS, WTF::AnyThreadsAccessTraits>::NeverDestroyed<>() at /Users/ajuma/syncWebKit/WebKitBuild/Debug-iphonesimulator/usr/local/include/wtf/NeverDestroyed.h:67
#24	0x000000028b9b96b5 in WTF::NeverDestroyed<WebCore::CoreAudioCaptureSourceFactoryIOS, WTF::AnyThreadsAccessTraits>::NeverDestroyed<>() at /Users/ajuma/syncWebKit/WebKitBuild/Debug-iphonesimulator/usr/local/include/wtf/NeverDestroyed.h:65
#25	0x000000028b9b967d in WebCore::CoreAudioCaptureSourceFactory::singleton() at /Users/ajuma/syncWebKit/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:101
#26	0x000000028f5d43c1 in WebCore::MockRealtimeAudioSourceFactory::activeSource() at /Users/ajuma/syncWebKit/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp:190
#27	0x000000028d61e2e2 in WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState(WebCore::Document&) at /Users/ajuma/syncWebKit/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:471
#28	0x000000028e06a2ce in WebCore::Document::pageMutedStateDidChange() at /Users/ajuma/syncWebKit/Source/WebCore/dom/Document.cpp:4223
#29	0x000000028efc9259 in WebCore::Page::setMuted(unsigned int)::$_42::operator()(WebCore::Document&) const at /Users/ajuma/syncWebKit/Source/WebCore/page/Page.cpp:1951
#30	0x000000028efc9213 in WTF::Detail::CallableWrapper<WebCore::Page::setMuted(unsigned int)::$_42, void, WebCore::Document&>::call(WebCore::Document&) at /Users/ajuma/syncWebKit/WebKitBuild/Debug-iphonesimulator/usr/local/include/wtf/Function.h:52
#31	0x000000028ef8164a in WTF::Function<void (WebCore::Document&)>::operator()(WebCore::Document&) const at /Users/ajuma/syncWebKit/WebKitBuild/Debug-iphonesimulator/usr/local/include/wtf/Function.h:84
#32	0x000000028ef73afc in WebCore::Page::forEachDocument(WTF::Function<void (WebCore::Document&)> const&) const at /Users/ajuma/syncWebKit/Source/WebCore/page/Page.cpp:3084
#33	0x000000028ef7c8ca in WebCore::Page::setMuted(unsigned int) at /Users/ajuma/syncWebKit/Source/WebCore/page/Page.cpp:1950
#34	0x00000002719750dc in WebKit::WebPage::setMuted(unsigned int) at /Users/ajuma/syncWebKit/Source/WebKit/WebProcess/WebPage/WebPage.cpp:5134
#35	0x0000000271970bfc in WebKit::WebPage::WebPage(WTF::ObjectIdentifier<WebCore::PageIdentifierType>, WebKit::WebPageCreationParameters&&) at /Users/ajuma/syncWebKit/Source/WebKit/WebProcess/WebPage/WebPage.cpp:687
#36	0x000000027196e975 in WebKit::WebPage::WebPage(WTF::ObjectIdentifier<WebCore::PageIdentifierType>, WebKit::WebPageCreationParameters&&) at /Users/ajuma/syncWebKit/Source/WebKit/WebProcess/WebPage/WebPage.cpp:482
#37	0x000000027196e868 in WebKit::WebPage::create(WTF::ObjectIdentifier<WebCore::PageIdentifierType>, WebKit::WebPageCreationParameters&&) at /Users/ajuma/syncWebKit/Source/WebKit/WebProcess/WebPage/WebPage.cpp:388
#38	0x0000000271492914 in WebKit::WebProcess::createWebPage(WTF::ObjectIdentifier<WebCore::PageIdentifierType>, WebKit::WebPageCreationParameters&&) at /Users/ajuma/syncWebKit/Source/WebKit/WebProcess/WebProcess.cpp:721
Comment 1 Alexey Proskuryakov 2020-08-05 08:56:38 PDT
Thank you for the report! This is an issue below WebKit, tracked by Apple internally as rdar://problem/65042181