Title: [275268] trunk/Source/WebKit
Revision
275268
Author
[email protected]
Date
2021-03-30 22:34:37 -0700 (Tue, 30 Mar 2021)

Log Message

ASSERT(m_sendPort) in IPC::Connection::open() when running some iOS unit tests
https://bugs.webkit.org/show_bug.cgi?id=223982
<rdar://75974285>

Reviewed by Alexey Proskuryakov.

If the UIProcess exits or severs it connection to the WebProcess while the WebProcess is
launching, the WebProcess ends up getting an invalid mach port upon initialization. This
is expected and XPCServiceInitializerDelegate::getConnectionIdentifier() was dealing with
this. getConnectionIdentifier() was checking if the port was invalid by checking if it was
MACH_PORT_NULL and calling exit() in such case. However, something has changed (likely
at OS level) and we are now sometimes getting MACH_PORT_DEAD instead of MACH_PORT_NULL.
The proper way to check if a mach port is valid is to call MACH_PORT_VALID(), which checks
for both MACH_PORT_NULL and MACH_PORT_DEAD. I therefore updated getConnectionIdentifier()
to use MACH_PORT_VALID() instead of an explicit check for MACH_PORT_NULL. This gets rid
of debug assertions we were seeing in the output of some iOS unit tests.

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (275267 => 275268)


--- trunk/Source/WebKit/ChangeLog	2021-03-31 04:25:00 UTC (rev 275267)
+++ trunk/Source/WebKit/ChangeLog	2021-03-31 05:34:37 UTC (rev 275268)
@@ -1,5 +1,27 @@
 2021-03-30  Chris Dumez  <[email protected]>
 
+        ASSERT(m_sendPort) in IPC::Connection::open() when running some iOS unit tests
+        https://bugs.webkit.org/show_bug.cgi?id=223982
+        <rdar://75974285>
+
+        Reviewed by Alexey Proskuryakov.
+
+        If the UIProcess exits or severs it connection to the WebProcess while the WebProcess is
+        launching, the WebProcess ends up getting an invalid mach port upon initialization. This
+        is expected and XPCServiceInitializerDelegate::getConnectionIdentifier() was dealing with
+        this. getConnectionIdentifier() was checking if the port was invalid by checking if it was
+        MACH_PORT_NULL and calling exit() in such case. However, something has changed (likely
+        at OS level) and we are now sometimes getting MACH_PORT_DEAD instead of MACH_PORT_NULL.
+        The proper way to check if a mach port is valid is to call MACH_PORT_VALID(), which checks
+        for both MACH_PORT_NULL and MACH_PORT_DEAD. I therefore updated getConnectionIdentifier()
+        to use MACH_PORT_VALID() instead of an explicit check for MACH_PORT_NULL. This gets rid
+        of debug assertions we were seeing in the output of some iOS unit tests.
+
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier):
+
+2021-03-30  Chris Dumez  <[email protected]>
+
         Service Worker scripts use too much memory in the network process
         https://bugs.webkit.org/show_bug.cgi?id=223808
         <rdar://75637093>

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm (275267 => 275268)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2021-03-31 04:25:00 UTC (rev 275267)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2021-03-31 05:34:37 UTC (rev 275268)
@@ -62,7 +62,7 @@
 bool XPCServiceInitializerDelegate::getConnectionIdentifier(IPC::Connection::Identifier& identifier)
 {
     mach_port_t port = xpc_dictionary_copy_mach_send(m_initializerMessage, "server-port");
-    if (port == MACH_PORT_NULL)
+    if (!MACH_PORT_VALID(port))
         return false;
 
     identifier = IPC::Connection::Identifier(port, m_connection);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to