Title: [291110] trunk/Source/WebKit
Revision
291110
Author
cdu...@apple.com
Date
2022-03-10 08:01:08 -0800 (Thu, 10 Mar 2022)

Log Message

Unreviewed, reverting r290795.

Caused crashes <rdar://problem/89970722>

Reverted changeset:

"[macOS] WebContent processes crash with
XPC_EXIT_REASON_SIGTERM_TIMEOUT when logging out"
https://bugs.webkit.org/show_bug.cgi?id=237398
https://commits.webkit.org/r290795

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291109 => 291110)


--- trunk/Source/WebKit/ChangeLog	2022-03-10 15:57:15 UTC (rev 291109)
+++ trunk/Source/WebKit/ChangeLog	2022-03-10 16:01:08 UTC (rev 291110)
@@ -1,3 +1,16 @@
+2022-03-10  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, reverting r290795.
+
+        Caused crashes <rdar://problem/89970722>
+
+        Reverted changeset:
+
+        "[macOS] WebContent processes crash with
+        XPC_EXIT_REASON_SIGTERM_TIMEOUT when logging out"
+        https://bugs.webkit.org/show_bug.cgi?id=237398
+        https://commits.webkit.org/r290795
+
 2022-03-10  Youenn Fablet  <you...@apple.com>
 
         Remove RemoteVideoSample

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h (291109 => 291110)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h	2022-03-10 15:57:15 UTC (rev 291109)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h	2022-03-10 16:01:08 UTC (rev 291110)
@@ -82,7 +82,7 @@
 }
 
 #if PLATFORM(MAC)
-void setOSTransaction(OSObjectPtr<os_transaction_t>&&);
+OSObjectPtr<os_transaction_t>& osTransaction();
 #endif
 
 template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
@@ -113,7 +113,7 @@
     // so ensure that we have an outstanding transaction here. This is not needed on iOS because
     // the UIProcess takes process assertions on behalf of its child processes.
 #if PLATFORM(MAC)
-    setOSTransaction(adoptOSObject(os_transaction_create("WebKit XPC Service")));
+    osTransaction() = adoptOSObject(os_transaction_create("WebKit XPC Service"));
 #endif
 
     InitializeWebKit2();

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


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2022-03-10 15:57:15 UTC (rev 291109)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2022-03-10 16:01:08 UTC (rev 291110)
@@ -29,7 +29,6 @@
 #import "SandboxUtilities.h"
 #import "XPCServiceEntryPoint.h"
 #import <WebCore/ProcessIdentifier.h>
-#import <signal.h>
 #import <wtf/cocoa/Entitlements.h>
 #import <wtf/spi/darwin/SandboxSPI.h>
 #import <wtf/text/StringToIntegerConversion.h>
@@ -160,27 +159,10 @@
 }
 
 #if PLATFORM(MAC)
-void setOSTransaction(OSObjectPtr<os_transaction_t>&& transaction)
+OSObjectPtr<os_transaction_t>& osTransaction()
 {
-    static NeverDestroyed<OSObjectPtr<os_transaction_t>> globalTransaction;
-
-    // Because we don't use RunningBoard on macOS, we leak an OS transaction to control the lifetime of our XPC
-    // services ourselves. However, one of the side effects of leaking this transaction is that the default SIGTERM
-    // handler doesn't cleanly exit our XPC services when logging out or rebooting. This led to crashes with
-    // XPC_EXIT_REASON_SIGTERM_TIMEOUT as termination reason (rdar://88940229). To address the issue, we now set our
-    // own SIGTERM handler that releases the OS transaction and calls the default SIGTERM handler. In the future, we
-    // should likely adopt RunningBoard on macOS and control our lifetime via process assertions instead of leaking
-    // this OS transaction.
-    static std::once_flag onceKey;
-    std::call_once(onceKey, [] {
-        signal(SIGTERM, [](int) {
-            globalTransaction.get() = nullptr;
-            signal(SIGTERM, SIG_DFL);
-            raise(SIGTERM);
-        });
-    });
-
-    globalTransaction.get() = WTFMove(transaction);
+    static NeverDestroyed<OSObjectPtr<os_transaction_t>> transaction;
+    return transaction.get();
 }
 #endif
 
@@ -190,7 +172,7 @@
     priorityBoostMessage = nullptr;
 
 #if PLATFORM(MAC)
-    setOSTransaction(nullptr);
+    osTransaction() = nullptr;
 #endif
 
     xpc_transaction_exit_clean();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to