[launchd-dev] Enforce a maximum time that a launchd process can live...
Michael Ledford
michael at ledford.cc
Tue Jan 26 08:04:10 PST 2010
Hello,
I have a process I would like to used launchd to control. Its job is
very simple; look for messages that are waiting in a SQLite database
and send them synchronously with NSMutableURLRequest via HTTP. The
problem I face is occasionally on production machines I have found
that the networking request becomes stalled for some reason which
causes the process to simply sit waiting.
I was hoping that launchd would be able to enforce a maximum time that
a process can live using the ExitTimeout key. The documentation isn't
very clear to me on this point. At first I took it as this is the
maximum length of time the process would live before launchd would
send it a SIGKILL. However, it was pointed out to me by someone they
believe it is the time between launchd sending a SIGTERM and SIGKILL.
This would only occur if the launchd process was stopped or removed
and doesn't exit within the specified ExitTimeout causing a SIGKILL to
be sent.
In the ideal world people would say, "Your problem is a bug and it
needs to be fixed." However, in the real world where frameworks are
not under my control this isn't an option. In this case I want to work
around the problem. I want to specify a maximum amount of time that a
process can live and then have it terminated if it exceeds that time.
Can I accomplish a process living for a certain amount of time and
then being asked to terminate via launchd? If not, what other options
do I have?
Thanks,
Michael
More information about the launchd-dev
mailing list