On Aug 7, 2009, at 11:01 AM, Sidney San Martín wrote:
I'm building a daemon that uses a launchd-provided socket, it seems like a good idea to exit when nothing's connected.
I've read that jobs must stay alive for 60 seconds, but launchd is giving me a 30 second timeout at checkin. What's right? How are daemon timeouts supposed to work?
I'm not sure where you read that, but it sounds like someone, somewhere, is misunderstanding something. launchd gives each job a default ThrottleInterval of 10 seconds. This means that, if your job comes alive and then exits two seconds later and then immediately needs to be respawned, launchd will schedule your job to be run 8 seconds from that point. Thus, your job's start times must be at least 10 seconds apart by default, which establishes an effective minimum run time. You can override this with the ThrottleInterval key if you'd like. So if you have an idle exit timeout of 30 seconds, you'll be fine. -- Damien Sorresso BSD Engineering Apple Inc.