<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>232314</bug_id>
          
          <creation_ts>2021-10-26 09:51:45 -0700</creation_ts>
          <short_desc>Network process crash when fetching WebsiteDataType::ResourceLoadStatistics or calling webkit_website_data_manager_get_itp_summary() in ephemeral sessions</short_desc>
          <delta_ts>2025-03-29 12:17:44 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2017496</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>kkinnunen</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
    
    <cc>zyx</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1808909</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 09:51:45 -0700</bug_when>
    <thetext>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&amp;t=Coz3VzYSQm. That backtrace is for 2.32, but I&apos;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-&gt;resourceLoadStatistics()) {
                resourceLoadStatistics-&gt;registrableDomains([callbackAggregator](auto&amp;&amp; domains) mutable {
                    while (!domains.isEmpty())
                        callbackAggregator-&gt;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&apos;s ultimately triggered via WebsiteDataStore::parameters and WebsiteDataStore::setResourceLoadStatisticsEnabled. Maybe that would be the right place to force it to false for ephemeral sessions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811155</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-11-02 09:52:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/84934873&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1812823</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-11-08 14:00:06 -0800</bug_when>
    <thetext>Hi John, any preferences on how to fix this? If not, I&apos;ll probably go for a localized fix in NetworkProcess::fetchWebsiteData.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1819306</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-12-01 10:15:18 -0800</bug_when>
    <thetext>I can&apos;t reproduce this anymore, not with trunk and not with 2.34.1 either. I&apos;m not sure when this somehow got fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1819350</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-12-01 12:00:39 -0800</bug_when>
    <thetext>Actually I can reproduce with 2.34.1, but not with trunk. Going to leave this closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2068600</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-10-16 16:15:20 -0700</bug_when>
    <thetext>Reopening because I just hit this again today. Updated backtrace looks like:

#0  __pthread_kill_implementation (threadid=&lt;optimized out&gt;, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f0afd29af83 in __pthread_kill_internal (threadid=&lt;optimized out&gt;, signo=6) at pthread_kill.c:78
#2  0x00007f0afd24208e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f0afd229882 in __GI_abort () at abort.c:79
#4  0x00007f0afdae8ddf in WTFCrashWithInfo () at WTF/Headers/wtf/Assertions.h:864
#5  0x00007f0afdd9ae36 in WebKit::WebResourceLoadStatisticsStore::postTask (this=0x7f0ae3018400, task=&lt;optimized out&gt;)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:201
#6  WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData (this=0x7f0ae3018400, completionHandler=&lt;optimized out&gt;)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:1561
...

I&apos;ll omit the rest of the backtrace because it&apos;s just this release assert:

inline void WebResourceLoadStatisticsStore::postTask(WTF::Function&lt;void()&gt;&amp;&amp; task)
{
    // Resource load statistics should not be captured for ephemeral sessions.
    RELEASE_ASSERT(!isEphemeral());

It&apos;s reproducible by opening Epiphany&apos;s Privacy Report dialog in a private browsing window, which calls webkit_website_data_manager_get_itp_summary(). Apparently that&apos;s guaranteed to crash the network process if called for an ephemeral session? I suppose the WebKit API will need to guard against this usage somewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2107168</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-03-29 12:17:44 -0700</bug_when>
    <thetext>*** Bug 290391 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>