<?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>282384</bug_id>
          
          <creation_ts>2024-10-31 06:23:37 -0700</creation_ts>
          <short_desc>Crash in WebKit::WebPageProxy::sendWheelEvent because connection is null</short_desc>
          <delta_ts>2025-11-06 15:29:07 -0800</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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>283546</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=295679</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="Charlie Wolfe">charliew</assigned_to>
          <cc>achristensen</cc>
    
    <cc>a_protyasha</cc>
    
    <cc>cdumez</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2071853</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-10-31 06:23:37 -0700</bug_when>
    <thetext>(gdb) bt
#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  0x00007f344273be03 in __pthread_kill_internal (threadid=&lt;optimized out&gt;, signo=6) at pthread_kill.c:78
#2  0x00007f34426e308e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f34426ca882 in __GI_abort () at abort.c:79
#4  0x00007f343e0e8ddf in WTFCrashWithInfo () at WTF/Headers/wtf/Assertions.h:864
#5  0x00007f343e5329d6 in WebKit::AuxiliaryProcessProxy::connection (this=0x0)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h:131
#6  WebKit::WebPageProxy::sendWheelEvent
    (this=0x7f342570dd80, frameID=..., event=..., processingSteps=..., rubberBandableEdges=..., willStartSwipe=std::optional [no contained value], wasHandledForScrolling=&lt;optimized out&gt;) at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/WebPageProxy.cpp:3807
#7  0x00007f343e5322d8 in WebKit::WebPageProxy::continueWheelEventHandling
    (this=0x7f342570dd80, wheelEvent=..., result=..., willStartSwipe=std::optional [no contained value])
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/WebPageProxy.cpp:3798
#8  0x00007f343e532096 in WebKit::WebPageProxy::handleWheelEvent (this=0x7f342570dd80, wheelEvent=...)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/WebPageProxy.cpp:3767
#9  WebKit::WebPageProxy::handleNativeWheelEvent (this=0x7f342570dd80, nativeWheelEvent=&lt;optimized out&gt;)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/WebPageProxy.cpp:3758
#10 0x00007f343e63e9ae in handleScroll
    (webViewBase=0x55cd50dc5200 [EphyWebView], deltaX=&lt;error reading variable: That operation is not available on integers of more than 8 bytes.&gt;, deltaY=&lt;error reading variable: That operation is not available on integers of more than 8 bytes.&gt;, isEnd=false, eventController=&lt;optimized out&gt;)
    at /buildstream/gnome/sdk/webkitgtk-6.0.bst/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:1650
#15 0x00007f34436d41b3 in &lt;emit signal &apos;scroll&apos; on instance 0x55cd52594f00 [GtkEventControllerScroll]&gt;
    (instance=instance@entry=0x55cd52594f00, signal_id=&lt;optimized out&gt;, detail=detail@entry=0) at ../gobject/gsignal.c:3582

Crash is here:

void WebPageProxy::sendWheelEvent(WebCore::FrameIdentifier frameID, const WebWheelEvent&amp; event, OptionSet&lt;WheelEventProcessingSteps&gt; processingSteps, RectEdges&lt;bool&gt; rubberBandableEdges, std::optional&lt;bool&gt; willStartSwipe, bool wasHandledForScrolling)
{
#if HAVE(DISPLAY_LINK)
    internals().wheelEventActivityHysteresis.impulse();
#endif

    Ref connection = m_legacyMainFrameProcess-&gt;connection();

AuxiliaryProcessProxy::connection returns a RefPtr, but we incorrectly assume that it&apos;s not nul and assign it directly to a Ref.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2071923</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-10-31 11:37:10 -0700</bug_when>
    <thetext>This happened with WebKitGTK 2.46.1 and, as usual, I unfortunately don&apos;t have a reproducer.

(In reply to Michael Catanzaro from comment #0)
&gt; AuxiliaryProcessProxy::connection returns a RefPtr, but we incorrectly
&gt; assume that it&apos;s not nul and assign it directly to a Ref.

Um, I have no clue what I was looking at this morning, but it definitely was not AuxiliaryProcessProxy::connection, which returns a normal C++ reference, IPC::Connection&amp;, and does RELEASE_ASSERT(m_connection) to ensure it is not nullptr first. That assert is what is failing here. This can happen in two situations:

 * AuxiliaryProcessProxy::didFinishLaunching hasn&apos;t executed yet
 * AuxiliaryProcessProxy::shutDownProcess has already been executed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2073471</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-07 05:24:13 -0800</bug_when>
    <thetext>&lt;rdar://problem/139429454&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2073493</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2024-11-07 07:36:54 -0800</bug_when>
    <thetext>Might be related to https://commits.webkit.org/282353@main</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085010</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2025-01-06 02:39:26 -0800</bug_when>
    <thetext>Is this a crash inside sendWheelEventScrollingAccelerationCurveIfNecessary??</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085063</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-01-06 08:43:32 -0800</bug_when>
    <thetext>Hm, I think I misanalyzed this twice, in both my first comment, and then again in comment #1. The actual problem here is surely that m_legacyMainFrameProcess is nullptr. That&apos;s not expected because it&apos;s a Ref, not a RefPtr.

(In reply to Ryosuke Niwa from comment #4)
&gt; Is this a crash inside sendWheelEventScrollingAccelerationCurveIfNecessary??

Definitely not. It crashes before then:

void WebPageProxy::sendWheelEvent(WebCore::FrameIdentifier frameID, const WebWheelEvent&amp; event, OptionSet&lt;WheelEventProcessingSteps&gt; processingSteps, RectEdges&lt;bool&gt; rubberBandableEdges, std::optional&lt;bool&gt; willStartSwipe, bool wasHandledForScrolling)
{
#if HAVE(DISPLAY_LINK)
    internals().wheelEventActivityHysteresis.impulse();
#endif

    Ref connection = m_legacyMainFrameProcess-&gt;connection(); // &lt;-- crash is here
    if (drawingArea()-&gt;shouldSendWheelEventsToEventDispatcher()) {
        sendWheelEventScrollingAccelerationCurveIfNecessary(event);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085279</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2025-01-06 19:22:08 -0800</bug_when>
    <thetext>Oh, that makes sense because I added a release assert in connection() if you have that code. However, the latest codebase doesn&apos;t have that connection() call:
https://github.com/WebKit/WebKit/blob/c21bff762cc616d7b5905b8a19dc69c054a6a4bf/Source/WebKit/UIProcess/WebPageProxy.cpp#L4032</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085280</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2025-01-06 19:24:51 -0800</bug_when>
    <thetext>Looks like this was changed recently in 5ebdb0cd30e4e. Perhaps you don&apos;t have that change yet?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085285</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-01-06 19:45:26 -0800</bug_when>
    <thetext>Right. This was reported against WebKitGTK 2.46.1. The code on this tag is: https://github.com/WebKit/WebKit/blob/626653c49d366743a82476e84c4fb23fb222406c/Source/WebKit/UIProcess/WebPageProxy.cpp#L3801

Unfortunately if m_legacyMainFrameProcess is invalid as I suspect, then it&apos;s already too late and the other changes to protect the connection don&apos;t matter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087799</commentid>
    <comment_count>9</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2025-01-16 11:12:12 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/39137</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087808</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-16 11:32:13 -0800</bug_when>
    <thetext>Committed 289017@main (81ac6d828ecd): &lt;https://commits.webkit.org/289017@main&gt;

Reviewed commits have been landed. Closing PR #39137 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2157104</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-11-06 15:28:33 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 283546 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2157106</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-11-06 15:29:07 -0800</bug_when>
    <thetext>We&apos;ve now had two failed attempts to fix this (289017@main and 302030@main). Let&apos;s continue in bug #283546.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>