• 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: CFSocket freezes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFSocket freezes


  • Subject: Re: CFSocket freezes
  • From: Frank Illenberger <email@hidden>
  • Date: Mon, 28 Nov 2005 20:42:47 +0100

Becky,

I don't think this is the case. I have a separate thread accepting the connections, putting them for reading the request on a worker thread and writing the repsonse on the same thread. Then the connection is closed. The socket connections are not shared between worker threads. Perhaps it is some behaviour of AsyncSockets I am missing.
In the new version of my code, I removed AsyncSockets and used pure CFSockets but with synchronous writing on the worker threads and now it is working fine.


Frank


On 28.11.2005, at 19:30, Becky Willrich wrote:

The socket write stream is trying to take the lock for the data shared between it and the read stream for the same socket (I think - there are other locks involved, but that's by far the most likely). Are there other threads running that could be manipulating the read stream or this write stream? You should be able to access the read stream safely (though of course there could be a bug), but other threads using the write stream would be verboten.

Hope that helps,
REW



On Nov 25, 2005, at 1:23 PM, Frank Illenberger wrote:

Hi,

I am developing a server using AsyncSocket/CFSocket wich is working fine with only exception, that it freezes in the acceptor thread in a call to CFWriteStreamOpen after having replied about 300-5000 requests. Sometimes it answers 100.000 requests without a problem but 50% of the time it freezes after 500 requests.
The stack trace of the frozen acceptor thread looks like this:



#0 0xffff85d8 in ___spin_lock_relinquish () at /System/Library/ Frameworks/System.framework/PrivateHeaders/ppc/cpu_capabilities.h:186
#1 0x90f1240c in _SocketStreamOpen ()
#2 0x9076c39c in _CFStreamOpen ()
#3 0x9076c314 in CFWriteStreamOpen ()
#4 0x10033f48 in -[AsyncSocket openStreamsAndReturnError:] (self=0x6ad8c30, _cmd=0x1005b800, errPtr=0x0)
#5 0x100338dc in -[AsyncSocket doAcceptWithSocket:] (self=0x398a40, _cmd=0x1005b8a0, newNative=21)
#6 0x100387e4 in -[AsyncSocket doCFSocketCallback:forSocket:withAddress:withData:] (self=0x398a40, _cmd=0x1005b4ac, type=kCFSocketAcceptCallBack, sock=0x399030, address=0x6ad9730, pData=0xf0080664)
#7 0x10038b68 in MyCFSocketCallback (sref=0x399030, type=kCFSocketAcceptCallBack, address=0x6ad9730, pData=0xf0080664, pInfo=0x398a40)
#8 0x90770944 in __CFSocketDoCallback ()
#9 0x90770668 in __CFSocketPerformV0 ()
#10 0x9075da5c in __CFRunLoopDoSources0 ()
#11 0x9075cf8c in __CFRunLoopRun ()
#12 0x9075ca0c in CFRunLoopRunSpecific ()
#13 0x928ea664 in -[NSRunLoop runMode:beforeDate:] ()
#14 0x9292f298 in -[NSRunLoop runUntilDate:] ()
#15 0x100394cc in -[WBLDefaultAdaptor runAcceptorThread] (self=0x38b280, _cmd=0x1005c354)
#16 0x928db6d4 in forkThreadForFunction ()
#17 0x9002b200 in _pthread_body ()



Has anybody observed a similar behavior with CFSocket does anybody know a way to get around this?


I am running 10.4.3.

Cheers

 Frank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: CFSocket freezes [solved]
  • Next by Date: Re: Is Apple's singleton sample code correct?
  • Previous by thread: Re: CFSocket freezes [solved]
  • Next by thread: Global Hotkeys (was: expose hotkeys)
  • Index(es):
    • Date
    • Thread