Bug 241666

Summary: ConnectionCocoa doesn't receive disconnect notifications before the client has finished initializing
Product: WebKit Reporter: Matt Woodrow <mattwoodrow>
Component: PlatformAssignee: Matt Woodrow <mattwoodrow>
Status: RESOLVED FIXED    
Severity: Normal CC: 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=160806

Matt Woodrow
Reported 2022-06-15 18:15:42 PDT
<rdar://94628205> Creating a server/client Connection requires a roundtrip from the server to the client. The server side allocates a port with receive rights, and sends this to the destination process (in the WebContent<->GPUP case, this goes via the UI process) as a port with send rights. Upon receiving this, the client also allocates a receive port, and sends the send right to the server via the send right it received upon initialisation. Once the server receives this, we have a fully initialised bi-directional connection. The handler for detecting disconnections (the client process crashing) is part of the send right that the server receives at the last stage of connection. This means that if the remote process crashes before we've finished the round-trip, then we never get notified, and the originating process can end up stuck waiting forever. We can fix this by temporarily adding a notifications request to the receive port, and listening for MACH_NOTIFY_NO_SENDERS, until we get a send port. Bug 160806 handled a similar case, for process launch connections.
Attachments
Matt Woodrow
Comment 1 2022-06-15 18:32:35 PDT
EWS
Comment 2 2022-06-21 18:06:20 PDT
Committed r295707 (251712@main): <https://commits.webkit.org/251712@main> Reviewed commits have been landed. Closing PR #1564 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.