<?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>229444</bug_id>
          
          <creation_ts>2021-08-24 08:29:39 -0700</creation_ts>
          <short_desc>Crash in [RBSTarget targetWithPid:] during WebProcessProxy::shutDown</short_desc>
          <delta_ts>2021-08-24 12:12:20 -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>
          
          
          <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="Ali Juma">ajuma</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>achristensen</cc>
    
    <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>sihui_liu</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1786743</commentid>
    <comment_count>0</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2021-08-24 08:29:39 -0700</bug_when>
    <thetext>Chrome for iOS is getting crash reports with the following stack, including on iOS 15 beta 6. The thrown exception is: &apos;must specify a valid pid&apos;. Since r259717 ensures the pid is non-zero, perhaps there are cases where the process has already died by the time we try to take an assertion.

0x000000018fa2e708	(CoreFoundation + 0x00129708)		__exceptionPreprocess
0x00000001a45387a4	(libobjc.A.dylib + 0x000287a4)		objc_exception_throw
0x000000018f9303b4	(CoreFoundation + 0x0002b3b4)		+[NSException raise:format:arguments:]
0x0000000190d064c0	(Foundation + 0x0007e4c0)		-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
0x0000000198e25188	(RunningBoardServices + 0x00027188)		+[RBSTarget targetWithProcessIdentifier:]
0x0000000198e2507c	(RunningBoardServices + 0x0002707c)		+[RBSTarget targetWithPid:]
0x000000019c203588	(WebKit + 0x003eb588)		WebKit::ProcessAssertion::ProcessAssertion(int, WTF::String const&amp;, WebKit::ProcessAssertionType)
0x000000019c203f2c	(WebKit + 0x003ebf2c)		WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion(int, WTF::String const&amp;, WebKit::ProcessAssertionType)
0x000000019bf1fb78	(WebKit + 0x00107b78)		IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog(WTF::OSObjectPtr&lt;NSObject&lt;OS_xpc_object&gt;*&gt;&amp;, WTF::Seconds)
0x000000019bf1c0c0	(WebKit + 0x001040c0)		IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog(WTF::OSObjectPtr&lt;NSObject&lt;OS_xpc_object&gt;*&gt;&amp;, WTF::Seconds)
0x000000019c11e378	(WebKit + 0x00306378)		WebKit::AuxiliaryProcessProxy::shutDownProcess()
0x000000019c1da3f0	(WebKit + 0x003c23f0)		WebKit::WebProcessProxy::shutDown()
0x000000019c1e7b48	(WebKit + 0x003cfb48)		WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch()
0x000000019c1e78c0	(WebKit + 0x003cf8c0)		WebKit::WebProcessProxy::didClose(IPC::Connection&amp;)
0x000000019be4c524	(WebKit + 0x00034524)		WTF::Detail::CallableWrapper&lt;IPC::Connection::connectionDidClose()::$_6, void&gt;::call()
0x0000000199dae15c	(JavaScriptCore + 0x00f6515c)		WTF::RunLoop::performWork()
0x0000000199daf12c	(JavaScriptCore + 0x00f6612c)		WTF::RunLoop::performWork(void*)
0x000000018f9a898c	(CoreFoundation + 0x000a398c)		__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
0x000000018f9a8888	(CoreFoundation + 0x000a3888)		__CFRunLoopDoSource0
0x000000018f9a7b8c	(CoreFoundation + 0x000a2b8c)		__CFRunLoopDoSources0
0x000000018f9a1b6c	(CoreFoundation + 0x0009cb6c)		__CFRunLoopRun
0x000000018f9a1304	(CoreFoundation + 0x0009c304)		CFRunLoopRunSpecific
0x00000001a7024730	(GraphicsServices + 0x00003730)		GSEventRunModal
0x000000019241f758	(UIKitCore + 0x00bca758)		-[UIApplication _run]
0x0000000192424fc8	(UIKitCore + 0x00bcffc8)		UIApplicationMain
0x00000001007d0bac	(Chrome -chrome_exe_main.mm:65)		main
0x000000018f65dcf4	(libdyld.dylib + 0x00001cf4)		start</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786745</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-08-24 08:50:55 -0700</bug_when>
    <thetext>I have just discussed this with a RunningBoard engineer. The most likely explanation is that the pid is &lt; 0 (which is possible since pid_t is an int on our Darwin). We get the pid from xpc_connection_get_pid() and I guess this could theoretically return a negative PID (maybe in case of error when the process has already exited).

I think we should tweak the PID check on WebKit side to early return if pid &lt;= 0 (instead of doing an early return when !pid).

Are you able to write up the patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786748</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-08-24 08:51:43 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #1)
&gt; I have just discussed this with a RunningBoard engineer. The most likely
&gt; explanation is that the pid is &lt; 0 (which is possible since pid_t is an int
&gt; on our Darwin). We get the pid from xpc_connection_get_pid() and I guess
&gt; this could theoretically return a negative PID (maybe in case of error when
&gt; the process has already exited).
&gt; 
&gt; I think we should tweak the PID check on WebKit side to early return if pid
&gt; &lt;= 0 (instead of doing an early return when !pid).
&gt; 
&gt; Are you able to write up the patch?

By the way, I haven&apos;t received such reports for MobileSafari yet, which is a bit odd. I have no idea what Chrome could be doing differently to cause this...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786749</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-08-24 08:55:32 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #2)
&gt; (In reply to Chris Dumez from comment #1)
&gt; &gt; I have just discussed this with a RunningBoard engineer. The most likely
&gt; &gt; explanation is that the pid is &lt; 0 (which is possible since pid_t is an int
&gt; &gt; on our Darwin). We get the pid from xpc_connection_get_pid() and I guess
&gt; &gt; this could theoretically return a negative PID (maybe in case of error when
&gt; &gt; the process has already exited).
&gt; &gt; 
&gt; &gt; I think we should tweak the PID check on WebKit side to early return if pid
&gt; &gt; &lt;= 0 (instead of doing an early return when !pid).
&gt; &gt; 
&gt; &gt; Are you able to write up the patch?
&gt; 
&gt; By the way, I haven&apos;t received such reports for MobileSafari yet, which is a
&gt; bit odd. I have no idea what Chrome could be doing differently to cause
&gt; this...

Do you know when this crash started for Chrome? And could you give us an idea of the frequency (i.e. is it a top crash?).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786767</commentid>
    <comment_count>4</comment_count>
      <attachid>436298</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-08-24 09:46:24 -0700</bug_when>
    <thetext>Created attachment 436298
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786781</commentid>
    <comment_count>5</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2021-08-24 10:07:56 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; (In reply to Chris Dumez from comment #2)
&gt; &gt; (In reply to Chris Dumez from comment #1)
&gt; &gt; &gt; I have just discussed this with a RunningBoard engineer. The most likely
&gt; &gt; &gt; explanation is that the pid is &lt; 0 (which is possible since pid_t is an int
&gt; &gt; &gt; on our Darwin). We get the pid from xpc_connection_get_pid() and I guess
&gt; &gt; &gt; this could theoretically return a negative PID (maybe in case of error when
&gt; &gt; &gt; the process has already exited).
&gt; &gt; &gt; 
&gt; &gt; &gt; I think we should tweak the PID check on WebKit side to early return if pid
&gt; &gt; &gt; &lt;= 0 (instead of doing an early return when !pid).
&gt; &gt; &gt; 
&gt; &gt; &gt; Are you able to write up the patch?
&gt; &gt; 
&gt; &gt; By the way, I haven&apos;t received such reports for MobileSafari yet, which is a
&gt; &gt; bit odd. I have no idea what Chrome could be doing differently to cause
&gt; &gt; this...
&gt; 
&gt; Do you know when this crash started for Chrome? And could you give us an
&gt; idea of the frequency (i.e. is it a top crash?).

We started getting this crash in iOS 14.0 (ideally we&apos;d have filed a WebKit bug earlier but it somehow fell through the cracks until now).

It represents about 0.22% of all crashes for the current version of Chrome, so it&apos;s not a top crash but it&apos;s not completely rare either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786876</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-08-24 12:11:22 -0700</bug_when>
    <thetext>Committed r281511 (240884@main): &lt;https://commits.webkit.org/240884@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 436298.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1786877</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-08-24 12:12:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/82303595&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>436298</attachid>
            <date>2021-08-24 09:46:24 -0700</date>
            <delta_ts>2021-08-24 12:11:23 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-229444-20210824094623.patch</filename>
            <type>text/plain</type>
            <size>2200</size>
            <attacher name="Chris Dumez">c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