• 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: Jerry Krinock <email@hidden>
  • Date: Thu, 6 Jan 2011 21:37:15 -0800

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.


On 2011 Jan 06, at 16:48, Dave Keck wrote:

> consider using NSMachPort
> instead of CFMessagePort; you can lose a lot of code in doing so.
> Here's an example showing how to set up a client and server using
> NSMachPort and NSMachBootstrapServer:
>
>    http://pastie.org/1435791
>
> This code would of course work the same if the client and server were
> in separate processes, assuming the server port is registered in a
> bootstrap context that's visible to the client.

Thank you.  It does look like less code.  I'll study it tomorrow.

_______________________________________________

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

  • Follow-Ups:
    • Re: [SOLVED] Unresponsive CFMessagePort
      • From: Jean-Daniel Dupas <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>)

  • Prev by Date: Re: Thumbs Lists
  • Next by Date: Re: Thumbs Lists
  • Previous by thread: Re: Troubleshooting CFMessagePort
  • Next by thread: Re: [SOLVED] Unresponsive CFMessagePort
  • Index(es):
    • Date
    • Thread