When is XPC_ERROR_TERMINATION_IMMINENT sent?

No matter what I try to do to quit/kill my XPC service while its processing a message, my client only ever gets XPC_ERROR_CONNECTION_INTERRUPTED and never XPC_ERROR_TERMINATION_IMMINENT. To be specific, I tried all these things:

  • Quitting the service while it's idle (SIGTERM)
  • Force-quitting the service while it's idle (SIGKILL)
  • Quitting the service while it's in the middle of processing a message (SIGTERM)
  • Force-quitting the service while it's in the middle of processing a message (SIGKILL)
  • Making the service quit itself in the middle of processing a message (exit(EXIT_SUCCESS))
  • Making the service cancel the connection in the middle of processing a message (xpc_connection_cancel(connection))

Hoping to find some examples of its usage, I searched around GitHub, and haven't really found anyone do much at all in response to this message. Some parts look like they come up from a common ancestor (probably some guide or template): https://github.com/search?q=%22The+client+process+on+the+other+end+of+the+connection+has+either%22&type=Code

Even Apple's own WebKit2 doesn't seem to do much with it: https://github.com/apple-opensource/WebKit2/search?q=XPC_ERROR_TERMINATION_IMMINENT

When does XPC_ERROR_TERMINATION_IMMINENT ever come into play?

Are you building an XPC Service? Or vending an XPC service from a launchd daemon or agent? And, if it’s the latter, do you have transactions enabled (EnableTransactions)?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Are you building an XPC Service? Or vending an XPC service from a launchd daemon or agent?

Both, in the same pattern as the "BetterAuthorizationSample" (using an XPC service to bless a privileged helper, on behalf of a sandboxed application).

do you have transactions enabled (EnableTransactions)?

I do not. (yet?)

Would you mind taking another look at this? I'm still curious about it

As am I. Unfortunately I’ve driven this as far as I can in the context of DevForums. If you really want an answer, open a DTS tech support incident. That’ll allow me to allocate more time to this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

When is XPC_ERROR_TERMINATION_IMMINENT sent?
 
 
Q