[webkit-changes] [WebKit/WebKit] 3c2c89: WebKit process termination with xpc_connection_kil...

Per Arne Vollan noreply at github.com
Mon Apr 15 13:05:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3c2c899f692d5278142b9c476868672da9ae8e04
      https://github.com/WebKit/WebKit/commit/3c2c899f692d5278142b9c476868672da9ae8e04
  Author: Per Arne Vollan <pvollan at apple.com>
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
    M Source/WebKit/Platform/cocoa/XPCUtilities.h
    M Source/WebKit/Platform/cocoa/XPCUtilities.mm
    M Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm
    M Source/WebKit/Shared/Cocoa/XPCEndpoint.mm
    M Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm

  Log Message:
  -----------
  WebKit process termination with xpc_connection_kill does not always work
https://bugs.webkit.org/show_bug.cgi?id=272669
rdar://126479653

Reviewed by Chris Dumez.

WebKit process termination with xpc_connection_kill does not always work. We are currently seeing flaky
termination behavior on macOS, where the child processes are not always terminated successfully.
Additionally, on iOS, the XPC connection has become anonymous due to migration to extensions for WebKit
processes, and xpc_connection_kill does not support anonymous connections. This patch addresses this
issue by creating and sending a XPC message to the child process to request termination. This has a
high chance of success, since we know that the XPC connection termination watchdog is holding a
background assertion on the process, so it is not suspended. Additionally, the XPC message is being
handled on the XPC event handler thread, which is handling very few messages, so it is very unlikely
that it is blocked and cannot handle the message. This gives the process a chance to exit cleanly and
send a reply back. If the UI process does not receive the expected reply, it will try calling
xpc_connection_kill.

* Source/WebKit/Platform/cocoa/XPCUtilities.h:
* Source/WebKit/Platform/cocoa/XPCUtilities.mm:
(WebKit::terminateWithReason):
(WebKit::handleXPCExitMessage):
* Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* Source/WebKit/Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):

Canonical link: https://commits.webkit.org/277509@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list