On macOS 27.x (Apple silicon) I've been measuring how launchd stops a job, and two
behaviors don't match the documentation.
Method: a throwaway job whose script traps SIGTERM and logs it, bootstrapped with different
ExitTimeOut values, then stopped with launchctl bootout while timing when the process dies.
Observed (LaunchAgent in the gui domain; the same results in the system domain with a
LaunchDaemon):
ExitTimeOut 45 -> `launchctl print` reports 45; SIGTERM, then SIGKILL at 45 s
ExitTimeOut 61 -> reports 60; SIGTERM, then SIGKILL at 60 s
ExitTimeOut 90 -> reports 60; SIGTERM, then SIGKILL at 60 s
ExitTimeOut 120 -> reports 60; SIGTERM, then SIGKILL at 60 s
ExitTimeOut 0 -> reports 0; SIGKILL after ~0.1 s, SIGTERM never deliveredman launchd.plist says of ExitTimeOut:
"The amount of time launchd waits between sending the SIGTERM signal and before sending a
SIGKILL signal when the job is to be stopped. The default value is system-defined. The
value zero is interpreted as infinity and should not be used, as it can stall system
shutdown forever."
So: is there a 60-second ceiling on ExitTimeOut? It isn't documented that I can find, and it
applies in both domains. And is zero meant to be "infinity" as documented, or an immediate
SIGKILL as observed? Finally, is there a supported way for a service to be given more than
60 seconds to exit when launchd stops it — or is 60 seconds simply the maximum?
Happy to file a Feedback with a minimal repro if that's useful.
2
0
150