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.
Pull request: https://github.com/WebKit/WebKit/pull/1564
Committed r295707 (251712@main): <https://commits.webkit.org/251712@main>
Reviewed commits have been landed. Closing PR #1564 and removing active labels.