Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
3891 | minor | always | 02-17-10 14:09 | 01-19-11 12:20 | |
|
|||||
Reporter: | ferg | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | |||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 4.0.15 | ||
|
|||||
Summary: | 0003891: add "watchdog" argument to watchdog | ||||
Description: |
(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. Success! 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: <key>AbandonProcessGroup</key> <true/> Here's the definition of AbandonProcessGroup: AbandonProcessGroup <boolean> 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. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
There are no notes attached to this issue. |