Bug 232314 - Network process crash when fetching WebsiteDataType::ResourceLoadStatistics in ephemeral sessions
Summary: Network process crash when fetching WebsiteDataType::ResourceLoadStatistics i...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-26 09:51 PDT by Michael Catanzaro
Modified: 2021-12-01 12:00 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-10-26 09:51:45 PDT
Reproducer: create an incognito mode window in Epiphany, open preferences, then open the personal data dialog. The network process will crash.

Detailed backtrace here: https://bugzilla-attachments.redhat.com/attachment.cgi?id=1837253&t=Coz3VzYSQm. That backtrace is for 2.32, but I've just reproduced with 2.34.1.

Problem is Epiphany fetches all types of website data, as is reasonable. NetworkProcess::fetchWebsiteData does this:

#if ENABLE(INTELLIGENT_TRACKING_PREVENTION)
    if (websiteDataTypes.contains(WebsiteDataType::ResourceLoadStatistics)) {
        if (auto* session = networkSession(sessionID)) {
            if (auto* resourceLoadStatistics = session->resourceLoadStatistics()) {
                resourceLoadStatistics->registrableDomains([callbackAggregator](auto&& domains) mutable {
                    while (!domains.isEmpty())
                        callbackAggregator->m_websiteData.registrableDomainsWithResourceLoadStatistics.add(domains.takeLast());
                });
            }
        }
    }
#endif

The call to WebResourceLoadStatisticsStore::registrableDomains calls WebResourceLoadStatisticsStore::postTask, and that does this:

// Resource load statistics should not be captured for ephemeral sessions.
RELEASE_ASSERT(!isEphemeral());

Oops. We either need an early return in NetworkProcess::fetchWebsiteData, or perhaps better in WebResourceLoadStatisticsStore::registrableDomains? Or maybe it would be better if NetworkSession::resourceLoadStatistics would return nullptr rather than a valid WebResourceLoadStatisticsStore when we have an ephemeral session? Or for NetworkSession::setResourceLoadStatisticsEnabled to never be called in the first place? That's ultimately triggered via WebsiteDataStore::parameters and WebsiteDataStore::setResourceLoadStatisticsEnabled. Maybe that would be the right place to force it to false for ephemeral sessions?
Comment 1 Radar WebKit Bug Importer 2021-11-02 09:52:16 PDT
<rdar://problem/84934873>
Comment 2 Michael Catanzaro 2021-11-08 14:00:06 PST
Hi John, any preferences on how to fix this? If not, I'll probably go for a localized fix in NetworkProcess::fetchWebsiteData.
Comment 3 Michael Catanzaro 2021-12-01 10:15:18 PST
I can't reproduce this anymore, not with trunk and not with 2.34.1 either. I'm not sure when this somehow got fixed.
Comment 4 Michael Catanzaro 2021-12-01 12:00:39 PST
Actually I can reproduce with 2.34.1, but not with trunk. Going to leave this closed.