<?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>263845</bug_id>
          
          <creation_ts>2023-10-29 01:36:49 -0700</creation_ts>
          <short_desc>REGRESSION(269895@main): ASSERTION FAILED: !m_deletionHasBegun for WebProcessPool</short_desc>
          <delta_ts>2023-10-29 14:42:33 -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>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=263820</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="Fujii Hironori">fujii</reporter>
          <assigned_to name="Fujii Hironori">fujii</assigned_to>
          <cc>cdumez</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1988298</commentid>
    <comment_count>0</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 01:36:49 -0700</bug_when>
    <thetext>REGRESSION(269895@main): ASSERTION FAILED: !m_deletionHasBegun for WebProcessPool

Windows port and GTK port Debug build are failing an assertion.

Buildbot: builder GTK-Linux-64-bit-Debug-Tests build 11576 (269898@main)
https://build.webkit.org/#/builders/63/builds/11576

ASSERTION FAILED: !m_deletionHasBegun
/app/webkit/WebKitBuild/GTK/Debug/WTF/Headers/wtf/ThreadSafeRefCounted.h(58) : void WTF::ThreadSafeRefCountedBase::ref() const
1   0x7ff9eeb4ca05 WTFCrash
2   0x7ff9eeb4ca1b WTFIsDebuggerAttached
3   0x7ff9f8483109 WTF::ThreadSafeRefCountedBase::ref() const
4   0x7ff9f880fbf5 WTF::Ref&lt;WebKit::WebProcessPool, WTF::RawPtrTraits&lt;WebKit::WebProcessPool&gt; &gt;::Ref(WebKit::WebProcessPool&amp;)
5   0x7ff9f958bb9c WebKit::WebProcessProxy::protectedProcessPool() const
6   0x7ff9f95824d3 WebKit::WebProcessProxy::processWillShutDown(IPC::Connection&amp;)
7   0x7ff9f9344eb2 WebKit::AuxiliaryProcessProxy::shutDownProcess()
8   0x7ff9f9582a2a WebKit::WebProcessProxy::shutDown()
9   0x7ff9f9572ed5 WebKit::WebProcessPool::~WebProcessPool()
10  0x7ff9f9573374 WebKit::WebProcessPool::~WebProcessPool()
11  0x7ff9f848339a WTF::ThreadSafeRefCounted&lt;API::Object, (WTF::DestructionThread)0&gt;::deref() const::{lambda()#1}::operator()() const
12  0x7ff9f84833e1 WTF::ThreadSafeRefCounted&lt;API::Object, (WTF::DestructionThread)0&gt;::deref() const
13  0x7ff9f95c9de1 WTF::DefaultRefDerefTraits&lt;WebKit::WebProcessPool&gt;::derefIfNotNull(WebKit::WebProcessPool*)
14  0x7ff9f95b84a2 WTF::RefPtr&lt;WebKit::WebProcessPool, WTF::RawPtrTraits&lt;WebKit::WebProcessPool&gt;, WTF::DefaultRefDerefTraits&lt;WebKit::WebProcessPool&gt; &gt;::~RefPtr()
15  0x7ff9f95acd84 WebKit::WebProcessProxy::WeakOrStrongPtr&lt;WebKit::WebProcessPool&gt;::~WeakOrStrongPtr()
16  0x7ff9f95807b6 WebKit::WebProcessProxy::~WebProcessProxy()
17  0x7ff9f958083e WebKit::WebProcessProxy::~WebProcessProxy()
18  0x7ff9f88181e4 WTF::ThreadSafeRefCounted&lt;WebKit::AuxiliaryProcessProxy, (WTF::DestructionThread)2&gt;::deref() const::{lambda()#1}::operator()() const
19  0x7ff9f882923c WTF::Detail::CallableWrapper&lt;WTF::ThreadSafeRefCounted&lt;WebKit::AuxiliaryProcessProxy, (WTF::DestructionThread)2&gt;::deref() const::{lambda()#1}, void&gt;::call()
20  0x7ff9ed58185b WTF::Function&lt;void ()&gt;::operator()() const
21  0x7ff9eebbcc10 WTF::ensureOnMainRunLoop(WTF::Function&lt;void ()&gt;&amp;&amp;)
22  0x7ff9f8818248 WTF::ThreadSafeRefCounted&lt;WebKit::AuxiliaryProcessProxy, (WTF::DestructionThread)2&gt;::deref() const
23  0x7ff9f8818018 WebKit::AuxiliaryProcessProxy::deref()
24  0x7ff9f8818301 WTF::Ref&lt;WebKit::WebProcessProxy, WTF::RawPtrTraits&lt;WebKit::WebProcessProxy&gt; &gt;::~Ref()
25  0x7ff9f9438a9c ~&lt;lambda&gt;
26  0x7ff9f948494c ~CallableWrapper
27  0x7ff9f9484974 ~CallableWrapper
28  0x7ff9eced7766 std::default_delete&lt;WTF::Detail::CallableWrapperBase&lt;void&gt; &gt;::operator()(WTF::Detail::CallableWrapperBase&lt;void&gt;*) const
29  0x7ff9eced3a6c std::unique_ptr&lt;WTF::Detail::CallableWrapperBase&lt;void&gt;, std::default_delete&lt;WTF::Detail::CallableWrapperBase&lt;void&gt; &gt; &gt;::~unique_ptr()
30  0x7ff9eced2fbe WTF::Function&lt;void ()&gt;::~Function()
31  0x7ff9eebe8b6f WTF::RunLoop::performWork()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988300</commentid>
    <comment_count>1</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 01:38:19 -0700</bug_when>
    <thetext>https://results.webkit.org/?suite=layout-tests&amp;test=fast%2Fdom%2FWindow%2FaddEventListener-implicit-this.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988301</commentid>
    <comment_count>2</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 02:51:31 -0700</bug_when>
    <thetext>Here is a crash log of Windows port.

Buildbot: builder WinCairo-64-bit-Debug-Tests build 21218 (269899@main)
https://build.webkit.org/#/builders/727/builds/21218

ASSERTION FAILED: !m_deletionHasBegun
C:\BW\WinCairo-64-bit-Debug-Build\build\WebKitBuild\Debug\WTF\Headers\wtf/ThreadSafeRefCounted.h(58) : ref
1   00007FF9078C1C19 WTFCrash
2   00007FF9078C1C39 WTFCrashWithSecurityImplication
3   00007FF8F91BBDAF WTF::ThreadSafeRefCountedBase::ref
4   00007FF8F9613D9E WTF::Ref&lt;WebKit::WebProcessPool,WTF::RawPtrTraits&lt;WebKit::WebProcessPool&gt; &gt;::Ref
5   00007FF8FA322FB2 WebKit::WebProcessProxy::protectedProcessPool
6   00007FF8FA3118B6 WebKit::WebProcessProxy::shutDown
7   00007FF8FA31301F WebKit::WebProcessPool::~WebProcessPool
8   00007FF8FA34E0F9 WebKit::WebProcessPool::~WebProcessPool
9   00007FF8F924F5A3 WTF::ThreadSafeRefCounted&lt;API::Object,0&gt;::deref::&lt;lambda_1&gt;::operator()
10  00007FF8F924F558 WTF::ThreadSafeRefCounted&lt;API::Object,0&gt;::deref
11  00007FF8FA3585F3 WTF::DefaultRefDerefTraits&lt;WebKit::WebProcessPool&gt;::derefIfNotNull
12  00007FF8FA358598 WTF::RefPtr&lt;WebKit::WebProcessPool,WTF::RawPtrTraits&lt;WebKit::WebProcessPool&gt;,WTF::DefaultRefDerefTraits&lt;WebKit::WebProcessPool&gt; &gt;::~RefPtr
13  00007FF8FA34806C WebKit::WebProcessProxy::WeakOrStrongPtr&lt;WebKit::WebProcessPool&gt;::~WeakOrStrongPtr
14  00007FF8FA32217A WebKit::WebProcessProxy::~WebProcessProxy
15  00007FF8FA34E189 WebKit::WebProcessProxy::~WebProcessProxy
16  00007FF8F9618593 WTF::ThreadSafeRefCounted&lt;WebKit::AuxiliaryProcessProxy,2&gt;::deref::&lt;lambda_1&gt;::operator()
17  00007FF8F9618537 WTF::Detail::CallableWrapper&lt;`lambda at C:\BW\WinCairo-64-bit-Debug-Build\build\WebKitBuild\Debug\WTF\Headers\wtf/ThreadSafeRefCounted.h:114:27&apos;,void&gt;::call
18  00007FF9078D7E24 WTF::Function&lt;void ()&gt;::operator()
19  00007FF90792E025 WTF::ensureOnMainRunLoop
20  00007FF8F9618278 WTF::ThreadSafeRefCounted&lt;WebKit::AuxiliaryProcessProxy,2&gt;::deref
21  00007FF8F96181E7 WebKit::AuxiliaryProcessProxy::deref
22  00007FF8F9617C5B WTF::Ref&lt;WebKit::WebProcessProxy,WTF::RawPtrTraits&lt;WebKit::WebProcessProxy&gt; &gt;::~Ref
23  00007FF8FA20B1FA WebKit::WebPageProxy::close::&lt;lambda_5&gt;::~(lambda at C:\BW\WinCairo-64-bit-Debug-Build\build\Source\WebKit\UIProcess/WebPageProxy.cpp:1482:33)
24  00007FF8FA243BB6 WTF::Detail::CallableWrapper&lt;`lambda at C:\BW\WinCairo-64-bit-Debug-Build\build\Source\WebKit\UIProcess/WebPageProxy.cpp:1482:33&apos;,void&gt;::~CallableWrapper
25  00007FF8FA243B49 WTF::Detail::CallableWrapper&lt;`lambda at C:\BW\WinCairo-64-bit-Debug-Build\build\Source\WebKit\UIProcess/WebPageProxy.cpp:1482:33&apos;,void&gt;::~CallableWrapper
26  00007FF9078CD6F1 std::default_delete&lt;WTF::Detail::CallableWrapperBase&lt;void&gt; &gt;::operator()
27  00007FF9078CD6A7 std::unique_ptr&lt;WTF::Detail::CallableWrapperBase&lt;void&gt;,std::default_delete&lt;WTF::Detail::CallableWrapperBase&lt;void&gt; &gt; &gt;::~unique_ptr
28  00007FF9078CC363 WTF::Function&lt;void ()&gt;::~Function
29  00007FF90795AD54 WTF::RunLoop::performWork
30  00007FF907A2F140 WTF::RunLoop::wndProc
31  00007FF907A2F077 WTF::RunLoop::RunLoopWndProc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988302</commentid>
    <comment_count>3</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 02:56:20 -0700</bug_when>
    <thetext>WebProcessProxy::protectedProcessPool() converts WeakOrStrongPtr&lt;WebProcessPool&gt; to Ref&lt;WebProcessPool&gt; without checking the liveness.
https://github.com/WebKit/WebKit/blob/ce8774c6b1ee8874b8262d16ad65fc8a576762e2/Source/WebKit/UIProcess/WebProcessProxy.cpp#L2103-L2112
This is a dangerous anti-pattern.
And, WeakPtr should return nullptr while  destroying the object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988309</commentid>
    <comment_count>4</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 05:49:36 -0700</bug_when>
    <thetext>&gt; 5   00007FF8FA322FB2 WebKit::WebProcessProxy::protectedProcessPool
&gt; 6   00007FF8FA3118B6 WebKit::WebProcessProxy::shutDown
&gt; 7   00007FF8FA31301F WebKit::WebProcessPool::~WebProcessPool

In this callstack, WebProcessPool is being destroyed.
~WebProcessPool calls WebProcessProxy::shutDown. This WebProcessProxy is prewarmed.
However, WebProcessProxy::shutDown calls WebProcessProxy::protectedProcessPool even though it doesn&apos;t retain the WebProcessPool ref counter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988339</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2023-10-29 10:44:09 -0700</bug_when>
    <thetext>Thanks for the report. I&apos;ll fix this shortly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988340</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2023-10-29 10:46:58 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/19690</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988341</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-10-29 10:49:30 -0700</bug_when>
    <thetext>Committed 269909@main (26b67379adea): &lt;https://commits.webkit.org/269909@main&gt;

Reviewed commits have been landed. Closing PR #19690 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988342</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-10-29 10:50:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/117654716&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988355</commentid>
    <comment_count>9</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2023-10-29 13:12:08 -0700</bug_when>
    <thetext>Re-opening for pull request https://github.com/WebKit/WebKit/pull/19694</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988366</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-10-29 14:42:30 -0700</bug_when>
    <thetext>Committed 269914@main (b75c1351a087): &lt;https://commits.webkit.org/269914@main&gt;

Reviewed commits have been landed. Closing PR #19694 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>