• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [SOLVED] Unresponsive CFMessagePort
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] Unresponsive CFMessagePort


  • Subject: Re: [SOLVED] Unresponsive CFMessagePort
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 7 Jan 2011 10:28:54 +0100

Le 7 janv. 2011 à 10:22, Jean-Daniel Dupas a écrit :

>
> 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.

Correction. This is not an implementation detail, it is part of the API. (See CFMachPortCreateWithPort() discussion in the CFMachPort API reference).

> That's why you should let the system choose the port name, and not try to force it.
>

-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Troubleshooting CFMessagePort (From: Jerry Krinock <email@hidden>)
 >Re: Troubleshooting CFMessagePort (From: Dave Keck <email@hidden>)
 >Re: Troubleshooting CFMessagePort (From: Dave Keck <email@hidden>)
 >Re: [SOLVED] Unresponsive CFMessagePort (From: Jerry Krinock <email@hidden>)
 >Re: [SOLVED] Unresponsive CFMessagePort (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: [SOLVED] Unresponsive CFMessagePort
  • Next by Date: Re: LOCATING MEDIA FILES IN MACINTOSH
  • Previous by thread: Re: [SOLVED] Unresponsive CFMessagePort
  • Next by thread: NSDocument updateChangeCount when using Bindings
  • Index(es):
    • Date
    • Thread