Le 7 janv. 2011 à 06:37, Jerry Krinock a écrit :

> 
> On 2011 Jan 06, at 17:33, Dave Keck wrote:
> 
>> Oh, `sudo launchctl bstree` might also be useful.
> 
> Thank you, Dave.  It was useful.  It told me that my server port was "active" 
> (A).  This confirms what the Client tells me, that the port is found, but 
> times out when connecting to it.  Odd, though, that, if I sent messages 
> repeatedly, the Client would get a couple seconds of 
> kCFMessagePortReceiveTimeout errors and then after that, 
> kCFMessagePortSendTimeout errors.
> 
> Thus knowing what to look for, I found the problem, which is that I was using 
> the same port name for two different transient tasks, but the port for the 
> second task was being created before the port for the first task was 
> invalidated and released.  This was because I was invalidating and releasing 
> the port in the server's -dealloc method, which was running lazily when an 
> autorelease pool was released.
> 
> Just for the record, the trick is that if you try to create a port while an 
> older port with the same name is  invalidated but not yet deallocated, an 
> exception is raised and logged in the console.  However if the older port is 
> still active, and then later invalidated and deallocated, you get this silent 
> failure, a nonresponsive port.

It is an implementation detail, but it appears that when you try to create a 
CFMachPort instance with a specified port name, the "create" function will 
check if an existing CFMachPort instance already exists for the specified 
mach_port, and return it if it exists.
That's why you should let the system choose the port name, and not try to force 
it.


-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to