Bug 233001

Summary: WebKit is unable to recover if a WebProcess gets terminated while it is launching
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, ggaren, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=232970
https://bugs.webkit.org/show_bug.cgi?id=233045
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Chris Dumez 2021-11-11 09:42:10 PST
WebKit is unable to recover if a WebProcess gets terminated while it is launching.
Comment 1 Chris Dumez 2021-11-11 09:42:23 PST
<rdar://85302938>
Comment 2 Chris Dumez 2021-11-11 09:50:33 PST
Created attachment 443960 [details]
Patch
Comment 3 Brent Fulgham 2021-11-11 10:24:23 PST
Comment on attachment 443960 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=443960&action=review

r=me

> Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm:326
> +        didFinishLaunchingProcess(0, IPC::Connection::Identifier());

It seems like it might be clearer if there was a method "didFailToLaunch" or something that could call "didFinishLaunchingProcess" with the right arguments, but also log something helpful to the console.
Comment 4 Chris Dumez 2021-11-11 10:42:36 PST
Created attachment 443972 [details]
Patch
Comment 5 Chris Dumez 2021-11-11 17:20:13 PST
Created attachment 444028 [details]
Patch
Comment 6 Chris Dumez 2021-11-12 07:24:18 PST
Comment on attachment 444028 [details]
Patch

Requesting review again. I had to change the approach a little bit to address an API test failure.
Comment 7 Brent Fulgham 2021-11-12 08:08:33 PST
Comment on attachment 444028 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=444028&action=review

r=me

> Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm:325
> +        terminateXPCConnection();

It's a little surprising that this is only an issue on macOS; do we not have a similar issue with our termination logic on iOS?
Comment 8 Chris Dumez 2021-11-12 08:09:30 PST
(In reply to Brent Fulgham from comment #7)
> Comment on attachment 444028 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=444028&action=review
> 
> r=me
> 
> > Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm:325
> > +        terminateXPCConnection();
> 
> It's a little surprising that this is only an issue on macOS; do we not have
> a similar issue with our termination logic on iOS?

The issue is for both Mac and iOS. This file is used by both and it merely badly named. I'll replace Mac with Cocoa in a follow-up for clarity.
Comment 9 Brent Fulgham 2021-11-12 08:15:03 PST
Comment on attachment 444028 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=444028&action=review

>>> Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm:325
>>> +        terminateXPCConnection();
>> 
>> It's a little surprising that this is only an issue on macOS; do we not have a similar issue with our termination logic on iOS?
> 
> The issue is for both Mac and iOS. This file is used by both and it merely badly named. I'll replace Mac with Cocoa in a follow-up for clarity.

Oh, wow! Yes -- please do! :-)
Comment 10 Chris Dumez 2021-11-12 08:18:59 PST
Comment on attachment 444028 [details]
Patch

Clearing flags on attachment: 444028

Committed r285720 (244179@main): <https://commits.webkit.org/244179@main>
Comment 11 Chris Dumez 2021-11-12 08:19:02 PST
All reviewed patches have been landed.  Closing bug.