[launchd-dev] Diagnosing launchd daemon failure to launch

Iain Delaney iain.delaney at gmail.com
Thu Nov 6 12:17:03 PST 2008

Hi Damien,
	Thanks for the feedback. I've looked at the SampleD code and plist,  
but there's something I don't understand. I based my domain sockets  
code on the code in the CFLocalServer sample program, and that code  
uses a string constant for the socket path, shared between the client  
and server. What is the purpose of putting the path in the daemon  
plist? If I put the path in the plist, and the server gets it from  
launchd, how does the client get to the socket?

Thanks for your help,

Iain Delaney

On 6-Nov-08, at 2:04 PM, Damien Sorresso wrote:

> On Nov 6, 2008, at 10:37 AM, Iain Delaney wrote:
>> Ahh, that was the problem. So the real issue is that my daemon is  
>> loading, but not responding to my client app.
>> I'm trying to use Distributed Objects on top of UNIX Domain  
>> sockets. The directory for the socket is /var/tmp, and the client  
>> and server can communicate if I run both programs inside XCode.  
>> However, when I move the daemon program to /Library/ 
>> PrivilegedHelperTools and copy to plist into /Library/LaunchDaemons  
>> everything stops working. The client seems to be hanging while  
>> trying to connect to the socket.
>> Any ideas what I'm doing wrong?
> I would highly recommend choosing a more stable location for your  
> socket, first of all. /var/tmp gets cleaned out periodically; I'd  
> suggest /var/run, which is only cleaned out at boot-time.
> Also, have you specified the socket in your daemon's  
> launchd.plist(5), and does your daemon check in with launchd to  
> obtain the descriptor for the socket? If the answer to either of  
> these questions is "No", please see the SampleD project.
> http://developer.apple.com/samplecode/SampleD/listing3.html
> -- 
> Damien Sorresso
> BSD Engineering
> Apple Inc.

More information about the launchd-dev mailing list