[launchd-dev] Stray Proccess Log message

Quinn eskimo1 at apple.com
Fri Feb 22 01:54:12 PST 2008


At 15:59 -0800 21/2/08, Nathan Duran wrote:
>NetAuthAgent and something mysteriously called "Locum" die this exact 
>same way constantly on 10.5.2, usually right before LAN traffic grinds
>to a halt for no apparent reason.

Locum is a privileged tool that Finder uses when it needs to do 
privileged file system operations.

/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/Resources/Locum

I have no idea why you're seeing this message for Locum and 
NetAuthAgent, but it's obvious that something has gone terribly 
wrong.  Regardless, it's not relevant to Geoff's original question.

>Looking at the chunk of code that
>prints these messages I've never been able to figure out *exactly* 
>what set of conditions precipitates them (I have an idea, but that 
>idea doesn't always match what I see going on), but they happen a lot, 
>even with shipping Apple code. So often that I'd be in favor of a more 
>verbose error message if such an idea were ever kicked around the
>office.

The following section of TN2083 "Daemons and Agents" gives a bunch of 
background material.

<http://developer.apple.com/technotes/tn2005/tn2083.html#SECCAREFULWITHTHATFORKEUGENE>

Dave can fill in the specific details, but here's the general gist of things...

When launchd starts a job, it puts the process in a unique process 
group.  When that process dies, launchd SIGTERMs the process group to 
'garbage collect' any processes that the main process might have 
launched.  The idea is as follows:

o If the main process launches a helper tool, the helper tool won't 
daemonise itself.  Thus, it will be in the same process group, and 
thus it will be killed by the SIGTERM.  This is generally a good 
thing because it means that, the next time launchd starts the main 
process, the main process starts with a clean slate.

o If the main process starts some other process that's meant to run 
/after/ the main process, the other process /must/ daemonise itself. 
That puts the other process in its own process group, and launchd 
will leave it alone.

It's likely that Geoff's launchd job is starting sendmail but not 
waiting for it to run to completion.  Thus, launchd is trying to 
garbage collect sendmail.  This is bad.  Frankly, it's just luck that 
it works at all.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list