[launchd-dev] TimeOut key — how long should a job really stay alive?
Sidney San Martín
s at sidneysm.com
Fri Aug 7 12:33:22 PDT 2009
Thanks, Damien, that makes sense.
I don't remember where I originally heard "60 seconds", but searching
the web for "living at least 60 seconds" brings up plenty of log
entries from launchd. Where's this figure coming from (i.e. are there
certain cases where your job must stay alive for that long)?
On Fri, Aug 7, 2009 at 2:12 PM, Damien Sorresso<dsorresso at apple.com> wrote:
> 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.
>
>
More information about the launchd-dev
mailing list