Skip to content
Permalink
Browse files
XPC services should release their os transaction when given a SIGTERM…
… signal

https://bugs.webkit.org/show_bug.cgi?id=227747
<rdar://72430454>

Patch by Alex Christensen <achristensen@webkit.org> on 2021-07-07
Reviewed by Geoff Garen.

Apparently when you shut down your computer, processes are given a SIGTERM signal and expected to release their os_transaction_t
to indicate that they can now be terminated "cleanly".

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):

Canonical link: https://commits.webkit.org/239460@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Christensen authored and webkit-commit-queue committed Jul 7, 2021
1 parent 67622a3 commit 40c80b9d8c0f522ee123a47c48ab2d4a7dfd7e1f
Showing 2 changed files with 18 additions and 0 deletions.
@@ -1,3 +1,17 @@
2021-07-07 Alex Christensen <achristensen@webkit.org>

XPC services should release their os transaction when given a SIGTERM signal
https://bugs.webkit.org/show_bug.cgi?id=227747
<rdar://72430454>

Reviewed by Geoff Garen.

Apparently when you shut down your computer, processes are given a SIGTERM signal and expected to release their os_transaction_t
to indicate that they can now be terminated "cleanly".

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):

2021-07-07 Alex Christensen <achristensen@webkit.org>

Use more Span
@@ -101,6 +101,10 @@ void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_
// the UIProcess takes process assertions on behalf of its child processes.
#if PLATFORM(MAC)
osTransaction() = adoptOSObject(os_transaction_create("WebKit XPC Service"));
signal(SIGTERM, [] (int signal) {
RELEASE_ASSERT(signal == SIGTERM);
osTransaction() = nullptr;
});
#endif

InitializeWebKit2();

0 comments on commit 40c80b9

Please sign in to comment.