Title: [284823] trunk/Source
Revision
284823
Author
[email protected]
Date
2021-10-25 14:33:50 -0700 (Mon, 25 Oct 2021)

Log Message

Use xpc_connection_copy_invalidation_reason where available for debugging daemon connection failures
https://bugs.webkit.org/show_bug.cgi?id=232152

Reviewed by Brady Eidson.

Source/WebKit:

* Platform/IPC/cocoa/DaemonConnectionCocoa.mm:
(WebKit::Daemon::ConnectionToMachService<Traits>::initializeConnectionIfNeeded const):
* Shared/Daemon/DaemonUtilities.mm:
(WebKit::startListeningForMachServiceConnections):

Source/WTF:

* wtf/PlatformHave.h:
* wtf/spi/darwin/XPCSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (284822 => 284823)


--- trunk/Source/WTF/ChangeLog	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WTF/ChangeLog	2021-10-25 21:33:50 UTC (rev 284823)
@@ -1,3 +1,13 @@
+2021-10-25  Alex Christensen  <[email protected]>
+
+        Use xpc_connection_copy_invalidation_reason where available for debugging daemon connection failures
+        https://bugs.webkit.org/show_bug.cgi?id=232152
+
+        Reviewed by Brady Eidson.
+
+        * wtf/PlatformHave.h:
+        * wtf/spi/darwin/XPCSPI.h:
+
 2021-10-25  Ayumi Kojima  <[email protected]>
 
         Unreviewed, reverting r284742.

Modified: trunk/Source/WTF/wtf/PlatformHave.h (284822 => 284823)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-10-25 21:33:50 UTC (rev 284823)
@@ -949,6 +949,7 @@
 #define HAVE_CFNETWORK_NSURLSESSION_HSTS_WITH_UNTRUSTED_ROOT 1
 #define HAVE_AUDIO_OBJECT_PROPERTY_ELEMENT_MAIN 1
 #define HAVE_IMAGE_RESTRICTED_DECODING 1
+#define HAVE_XPC_CONNECTION_COPY_INVALIDATION_REASON 1
 #endif
 
 #if (PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \

Modified: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h (284822 => 284823)


--- trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-10-25 21:33:50 UTC (rev 284823)
@@ -138,6 +138,10 @@
 extern "C" const char * const XPC_ACTIVITY_RANDOM_INITIAL_DELAY;
 extern "C" const char * const XPC_ACTIVITY_REQUIRE_NETWORK_CONNECTIVITY;
 
+#if HAVE(XPC_CONNECTION_COPY_INVALIDATION_REASON)
+extern "C" char * xpc_connection_copy_invalidation_reason(xpc_connection_t connection);
+#endif
+
 #if OS_OBJECT_USE_OBJC
 OS_OBJECT_DECL(os_transaction);
 #else

Modified: trunk/Source/WebKit/ChangeLog (284822 => 284823)


--- trunk/Source/WebKit/ChangeLog	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WebKit/ChangeLog	2021-10-25 21:33:50 UTC (rev 284823)
@@ -1,3 +1,15 @@
+2021-10-25  Alex Christensen  <[email protected]>
+
+        Use xpc_connection_copy_invalidation_reason where available for debugging daemon connection failures
+        https://bugs.webkit.org/show_bug.cgi?id=232152
+
+        Reviewed by Brady Eidson.
+
+        * Platform/IPC/cocoa/DaemonConnectionCocoa.mm:
+        (WebKit::Daemon::ConnectionToMachService<Traits>::initializeConnectionIfNeeded const):
+        * Shared/Daemon/DaemonUtilities.mm:
+        (WebKit::startListeningForMachServiceConnections):
+
 2021-10-25  Kate Cheney  <[email protected]>
 
         [App Privacy Report] CORS preflight requests attributed incorrectly

Modified: trunk/Source/WebKit/Platform/IPC/cocoa/DaemonConnectionCocoa.mm (284822 => 284823)


--- trunk/Source/WebKit/Platform/IPC/cocoa/DaemonConnectionCocoa.mm	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WebKit/Platform/IPC/cocoa/DaemonConnectionCocoa.mm	2021-10-25 21:33:50 UTC (rev 284823)
@@ -63,8 +63,14 @@
     xpc_connection_set_event_handler(m_connection.get(), [weakThis = WeakPtr { *this }](xpc_object_t event) {
         if (!weakThis)
             return;
-        if (event == XPC_ERROR_CONNECTION_INVALID)
+        if (event == XPC_ERROR_CONNECTION_INVALID) {
+#if HAVE(XPC_CONNECTION_COPY_INVALIDATION_REASON)
+            auto reason = std::unique_ptr<char[]>(xpc_connection_copy_invalidation_reason(weakThis->m_connection.get()));
+            WTFLogAlways("Failed to connect to mach service %s, reason: %s", weakThis->m_machServiceName.data(), reason.get());
+#else
             WTFLogAlways("Failed to connect to mach service %s, likely because it is not registered with launchd", weakThis->m_machServiceName.data());
+#endif
+        }
         if (event == XPC_ERROR_CONNECTION_INTERRUPTED) {
             // Daemon crashed, we will need to make a new connection to a new instance of the daemon.
             weakThis->m_connection = nullptr;

Modified: trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm (284822 => 284823)


--- trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm	2021-10-25 21:32:05 UTC (rev 284822)
+++ trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm	2021-10-25 21:33:50 UTC (rev 284823)
@@ -47,8 +47,14 @@
 #endif
 
         xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
-            if (event == XPC_ERROR_CONNECTION_INVALID)
+            if (event == XPC_ERROR_CONNECTION_INVALID) {
+#if HAVE(XPC_CONNECTION_COPY_INVALIDATION_REASON)
+                auto reason = std::unique_ptr<char[]>(xpc_connection_copy_invalidation_reason(peer));
+                NSLog(@"Failed to start listening for connections to mach service %s, reason: %s", serviceName, reason.get());
+#else
                 NSLog(@"Failed to start listening for connections to mach service %s, likely because it is not registered with launchd", serviceName);
+#endif
+            }
             if (event == XPC_ERROR_CONNECTION_INTERRUPTED) {
                 NSLog(@"Removing peer connection %p", peer);
                 connectionRemoved(peer);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to