|Anonymous | Login | Signup for a new account||12-03-2021 12:19 PST|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0003891||[Resin]||minor||always||02-17-10 14:09||01-19-11 12:20|
|Summary||0003891: add "watchdog" argument to watchdog|
(rep by Rob Lockstone)
The preferred way to launch processes at boot/login in OS X since 10.4 is to use launchd. From <http://developer.apple.com/MacOsX/launchd.html>, [^] "The launchd daemon takes over many tasks from cron, xinetd, mach_init, and init, which are UNIX programs that traditionally have handled system initialization, called system scripts, run startup items, and generally prepared the system for the user."
All well and good. It's a nice service and reasonably easy to manage, especially when using something like Lingon <http://www.macupdate.com/info.php/id/19879/lingon>. [^] However, launchd has one feature that is annoyingly incompatible with Resin 4.x; it kills all child processes that the first process started when the first process exits.
Unfortunately, from what I can tell, this is exactly what Resin 4.x does. The ResinBoot class is responsible for creating the WatchDog process, and the WatchDog is what creates and then monitors the main Resin process, but after the WatchDog starts, ResinBoot exits so launchd kills the child processes.
Buried down in an Apple Developer Connection document, Daemons and Agents, is a section titled "Careful With That Fork, Eugene" <http://j.mp/bHw3XZ>. [^] That's the section that explains how launchd will kill child processes if the original process exits. But it also lists a few work-arounds. The first two are specific to daemon and probably not doable for Resin, at least not without mucking around with Resin and rebuilding it. But the third, and of course the "least-preferable" by Apple's standards, is to use the AbandonProcessGroup property in Resin's startup plist file.
Once you have your .plist file created (easy with Lingon), you can either edit it directly (it should be in /Library/LaunchDaemons), or within Lingon switch into "Expert Mode" and choose the AbandonProcessGroup parameter from the "Insert parameter..." drop down. It will look like this in the plist file:
Here's the definition of AbandonProcessGroup:
When a job dies, launchd kills any remaining processes with the same process group ID as the job. Setting this key to true disables that behavior.
I can't say this is the best/only solution, but it worked for me.
|There are no notes attached to this issue.|
|02-17-10 14:09||ferg||New Issue|
|01-19-11 12:20||ferg||Assigned To||=> ferg|
|01-19-11 12:20||ferg||Status||new => closed|
|01-19-11 12:20||ferg||Resolution||open => fixed|
|01-19-11 12:20||ferg||Fixed in Version||=> 4.0.15|
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
26 total queries executed.|
24 unique queries executed.