[launchd-dev] Enforce a maximum time that a launchd process can live...

Damien Sorresso dsorresso at apple.com
Tue Jan 26 14:25:57 PST 2010


On Jan 26, 2010, at 11:23 AM, Michael Ledford wrote:
> On Jan 26, 2010, at 12:14 PM, Damien Sorresso wrote:
>> Is the NSMutableURLRequest encapsulated in some API that you're using which doesn't support a timeout interval? Because NSMutableURLRequest itself does.
> 
> No, the problem is with the NSMutableURLRequest itself. Even though it supports a timeout, default is 60 seconds, it simply gets stuck. I spoke with an engineer at WWDC about it and he was perplexed when we connected to a machine with the process and sampled it. In any case this subject is off topic for this list.

In that case, you should sample the process when it's stuck in NSMutableURLRequest and file a bug.

>> If this is the case, you can spin the synchronous call out into its own thread/GCD queue and install a timer that exits after 20 seconds (or however long you'd like).
> 
> I was contemplating installing an alarm, using ualarm(), and just allowing the default handler terminate when it gets the SIGALRM. Would this be acceptable?


I guess. But you're never really guaranteed that some framework behind the scenes isn't going to hijack SIGALRM. That's why I recommended GCD.
-- 
Damien Sorresso
BSD Engineering
Apple Inc.



More information about the launchd-dev mailing list