Bug 222713

Summary: REGRESSION (r272376): [iOS] ASSERTION FAILED: sessionID.isEphemeral() || !path.isEmpty() in WebKit::NetworkProcess::swServerForSession
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, ggaren, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=221384
Bug Depends on: 223023    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch none

Description Ryan Haddad 2021-03-03 23:36:49 PST
The following test is asserting on iOS debug bots:

    TestWebKitAPI.ResourceLoadStatistics.StoreSuspension
        ASSERTION FAILED: sessionID.isEphemeral() || !path.isEmpty()
        /Volumes/Data/worker/ios-simulator-14-debug/build/Source/WebKit/NetworkProcess/NetworkProcess.cpp(2436) : auto WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::(anonymous class)::operator()() const
        1   0x11e91ab09 WTFCrash
        2   0x10949518b WTFCrashWithInfo(int, char const*, char const*, int)
        3   0x10a0f7ea1 WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10::operator()() const
        4   0x10a0f7c8f void WTF::HashMapEnsureTranslator<WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::DefaultHash<PAL::SessionID> >::translate<WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >, PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10>(WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >&, PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10&&)
        5   0x10a0f7963 WTF::HashTableAddResult<WTF::HashTableIterator<PAL::SessionID, WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >, WTF::DefaultHash<PAL::SessionID>, WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::HashTraits<PAL::SessionID> > > WTF::HashTable<PAL::SessionID, WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >, WTF::DefaultHash<PAL::SessionID>, WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::HashTraits<PAL::SessionID> >::add<WTF::HashMapEnsureTranslator<WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::DefaultHash<PAL::SessionID> >, PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10>(PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10&&)
        6   0x10a0f76eb WTF::HashTableAddResult<WTF::HashTableIterator<PAL::SessionID, WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >, WTF::DefaultHash<PAL::SessionID>, WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::HashTraits<PAL::SessionID> > > WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::inlineEnsure<PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10>(PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10&&)
        7   0x10a0477c6 WTF::HashTableAddResult<WTF::HashTableIterator<PAL::SessionID, WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >, WTF::DefaultHash<PAL::SessionID>, WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::KeyValuePairTraits, WTF::HashTraits<PAL::SessionID> > > WTF::HashMap<PAL::SessionID, std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> >, WTF::DefaultHash<PAL::SessionID>, WTF::HashTraits<PAL::SessionID>, WTF::HashTraits<std::__1::unique_ptr<WebCore::SWServer, std::__1::default_delete<WebCore::SWServer> > > >::ensure<WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10>(PAL::SessionID const&, WebKit::NetworkProcess::swServerForSession(PAL::SessionID)::$_10&&)
        8   0x10a04050d WebKit::NetworkProcess::swServerForSession(PAL::SessionID)
        9   0x109fe3742 WebKit::NetworkConnectionToWebProcess::establishSWServerConnection()
        10  0x109fe348e WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(WebKit::NetworkProcess&, WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, IPC::Connection::Identifier)
        11  0x109fe318d WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess(WebKit::NetworkProcess&, WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, IPC::Connection::Identifier)
        12  0x109fe30ac WebKit::NetworkConnectionToWebProcess::create(WebKit::NetworkProcess&, WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, IPC::Connection::Identifier)
        13  0x10a03873f WebKit::NetworkProcess::createNetworkConnectionToWebProcess(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&)
        14  0x109a31939 void IPC::callMemberFunctionImpl<WebKit::NetworkProcess, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&), void (WTF::Optional<IPC::Attachment> const&, WebCore::HTTPCookieAcceptPolicy), std::__1::tuple<WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID>, 0ul, 1ul>(WebKit::NetworkProcess*, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&), WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment> const&, WebCore::HTTPCookieAcceptPolicy)>&&, std::__1::tuple<WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
        15  0x109a2fdf5 void IPC::callMemberFunction<WebKit::NetworkProcess, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&), void (WTF::Optional<IPC::Attachment> const&, WebCore::HTTPCookieAcceptPolicy), std::__1::tuple<WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID>, std::__1::integer_sequence<unsigned long, 0ul, 1ul> >(std::__1::tuple<WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID>&&, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment> const&, WebCore::HTTPCookieAcceptPolicy)>&&, WebKit::NetworkProcess*, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&))
        16  0x109a21ae1 void IPC::handleMessageAsync<Messages::NetworkProcess::CreateNetworkConnectionToWebProcess, WebKit::NetworkProcess, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&)>(IPC::Connection&, IPC::Decoder&, WebKit::NetworkProcess*, void (WebKit::NetworkProcess::*)(WTF::ObjectIdentifier<WebCore::ProcessIdentifierType>, PAL::SessionID, WTF::CompletionHandler<void (WTF::Optional<IPC::Attachment>&&, WebCore::HTTPCookieAcceptPolicy)>&&))
        17  0x109a1e7ae WebKit::NetworkProcess::didReceiveNetworkProcessMessage(IPC::Connection&, IPC::Decoder&)
        18  0x10a037018 WebKit::NetworkProcess::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
        19  0x10950f1a4 IPC::Connection::dispatchMessage(IPC::Decoder&)
        20  0x10950f98c IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)
        21  0x1095084cc IPC::Connection::SyncMessageState::ConnectionAndIncomingMessage::dispatch()
        22  0x1095086a1 IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection(IPC::Connection&)
        23  0x10951f751 IPC::Connection::SyncMessageState::processIncomingMessage(IPC::Connection&, std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >&)::$_1::operator()()
        24  0x10951f67e WTF::Detail::CallableWrapper<IPC::Connection::SyncMessageState::processIncomingMessage(IPC::Connection&, std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >&)::$_1, void>::call()
        25  0x11e945f52 WTF::Function<void ()>::operator()() const
        26  0x11e9c6545 WTF::RunLoop::performWork()
        27  0x11e9cae01 WTF::RunLoop::performWork(void*)
        28  0x1029d937a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
        29  0x1029d9272 __CFRunLoopDoSource0
        30  0x1029d8754 __CFRunLoopDoSources0
        31  0x1029d2f1f __CFRunLoopRun
        ASSERTION FAILED: databaseUpdated
        /Volumes/Data/worker/ios-simulator-14-debug/build/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm(75) : void WebKit::WebPage::platformDidReceiveLoadParameters(const WebKit::LoadParameters &)
        1   0x1a2802b09 WTFCrash
        2   0x1880ae18b WTFCrashWithInfo(int, char const*, char const*, int)
        3   0x1898ed0d7 WebKit::WebPage::platformDidReceiveLoadParameters(WebKit::LoadParameters const&)
        4   0x18a03a3da WebKit::WebPage::loadData(WebKit::LoadParameters&&)
        5   0x18a11dac0 void IPC::callMemberFunctionImpl<WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::LoadParameters&&), std::__1::tuple<WebKit::LoadParameters>, 0ul>(WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::LoadParameters&&), std::__1::tuple<WebKit::LoadParameters>&&, std::__1::integer_sequence<unsigned long, 0ul>)
        6   0x18a11cee0 void IPC::callMemberFunction<WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::LoadParameters&&), std::__1::tuple<WebKit::LoadParameters>, std::__1::integer_sequence<unsigned long, 0ul> >(std::__1::tuple<WebKit::LoadParameters>&&, WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::LoadParameters&&))
        7   0x18a0b5d8e void IPC::handleMessage<Messages::WebPage::LoadData, WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::LoadParameters&&)>(IPC::Decoder&, WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::LoadParameters&&))
        8   0x18a0aa884 WebKit::WebPage::didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&)
        9   0x18a0497be WebKit::WebPage::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
        10  0x1885b1491 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&)
        11  0x189a2eb57 WebKit::WebProcess::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
        12  0x1881281a4 IPC::Connection::dispatchMessage(IPC::Decoder&)
        13  0x18812898c IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)
        14  0x188128fe0 IPC::Connection::dispatchOneIncomingMessage()
        15  0x188147e58 IPC::Connection::enqueueIncomingMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)::$_9::operator()()
        16  0x188147d6e WTF::Detail::CallableWrapper<IPC::Connection::enqueueIncomingMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)::$_9, void>::call()
        17  0x1a282df52 WTF::Function<void ()>::operator()() const
        18  0x1a28ae545 WTF::RunLoop::performWork()
        19  0x1a28b2e01 WTF::RunLoop::performWork(void*)
        20  0x19789437a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
        21  0x197894272 __CFRunLoopDoSource0
        22  0x197893754 __CFRunLoopDoSources0
        23  0x19788df1f __CFRunLoopRun
        24  0x19788d6c6 CFRunLoopRunSpecific
        25  0x10ae257b9 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
        26  0x10ae259cd -[NSRunLoop(NSRunLoop) run]
        27  0x1991a8176 _xpc_objc_main
        28  0x1991aa115 xpc_main
        29  0x188d70502 WebKit::XPCServiceMain(int, char const**)
        30  0x18a44b27b WKXPCServiceMain
        31  0x10acfbd42 main

https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.ResourceLoadStatistics.StoreSuspension
Comment 1 Ryan Haddad 2021-03-03 23:37:52 PST
Test history suggests that this regressed with https://trac.webkit.org/changeset/272376/webkit
Comment 2 Radar WebKit Bug Importer 2021-03-03 23:38:02 PST
<rdar://problem/75023048>
Comment 3 Alex Christensen 2021-03-05 08:13:09 PST
After more tries than I would like to admit, I finally got an iOS simulator and build to reproduce this.  Fixing...
Comment 4 Alex Christensen 2021-03-05 09:57:41 PST
Created attachment 422377 [details]
Patch
Comment 5 Geoffrey Garen 2021-03-09 16:20:45 PST
Comment on attachment 422377 [details]
Patch

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

r=me

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:432
>      if (isNewEntry)
>          SandboxExtension::consumePermanently(cacheRootPathHandle);
> +    else
> +        ASSERT_NOT_REACHED();

I would just ASSERT(isNewEntry). Then no need for if/else.
Comment 6 Chris Dumez 2021-03-09 16:23:07 PST
Comment on attachment 422377 [details]
Patch

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

> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:51
> +    ~NetworkProcessCreationParameters();

Why are we adding this?

> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:52
> +    NetworkProcessCreationParameters& operator=(NetworkProcessCreationParameters&&);

ditto. Why are we not getting an implicit one?
Comment 7 Chris Dumez 2021-03-09 16:25:39 PST
Comment on attachment 422377 [details]
Patch

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

> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:50
> +    NetworkProcessCreationParameters(NetworkProcessCreationParameters&&);

Ditto. We should be getting an implicit one here. Why do we need to define it explicitly?
Comment 8 Alex Christensen 2021-03-09 16:35:28 PST
Comment on attachment 422377 [details]
Patch

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

>> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:51
>> +    ~NetworkProcessCreationParameters();
> 
> Why are we adding this?

I need to add a non-inline destructor so we don't need to include the definition of WebsiteDataStoreParameters here.  Because I added that, we need the others.
Comment 9 Chris Dumez 2021-03-09 16:36:11 PST
(In reply to Alex Christensen from comment #8)
> Comment on attachment 422377 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422377&action=review
> 
> >> Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h:51
> >> +    ~NetworkProcessCreationParameters();
> > 
> > Why are we adding this?
> 
> I need to add a non-inline destructor so we don't need to include the
> definition of WebsiteDataStoreParameters here.  Because I added that, we
> need the others.

OK. Makes sense then. Thanks.
Comment 10 Alex Christensen 2021-03-09 16:40:27 PST
http://trac.webkit.org/r274186
Comment 11 WebKit Commit Bot 2021-03-10 03:23:19 PST
Re-opened since this is blocked by bug 223023
Comment 12 Alex Christensen 2021-03-25 09:34:29 PDT
Created attachment 424254 [details]
Patch
Comment 13 EWS 2021-03-25 10:36:05 PDT
Committed r275047: <https://commits.webkit.org/r275047>

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