Re: CFSocket freezes
Re: CFSocket freezes
- Subject: Re: CFSocket freezes
- From: Felix Schwarz <email@hidden>
- Date: Mon, 28 Nov 2005 13:47:54 +0100
I think the last time I've written networking code directly using BSD
sockets is 5 years old by now. It was the leightweight heart of a
meta search engine, that queried several other sites at once, yet did
not have to be multi-threaded, because there are functions available
that allow you to wait for an event of interest to happen.
Judging from my experience back then, it needed some time to get
familiar with the API, but then it was pretty easy. And if you need
examples showing you how to do things, you should find plenty of
sample source on the web. Docs should also be available as man pages
in the shell/terminal.
I.e. check out
man socket
man bind
man connect
etc.
It should also be available in XCode these days. Also, you may want
to have a look at sys/socket.h.
Concerning the integration of sockets with runloops, I have no
experience to that point. However, I'm pretty sure, there must be a
possibility, because CFSockets are most likely using BSD sockets
under the hood as well.
Felix
Am 27.11.2005 um 16:20 schrieb Frank Illenberger:
Thank you Felix, these are interesting observations hinting towards
a problem in CFSocket itself. For now, I have submitted this case
as a Radar report.
I have no experience in directly using BSD sockets. Is it hard to
learn and will I be able to integrate it with the run loops of my
threads?
Am 27.11.2005 um 16:15 schrieb Felix Schwarz:
I haven't written much networking code for OS X yet, but I have
made some observations. I hope they are helpful in one way or
another.
Have you had a look at the CocoaHTTPServer sample code? I had a
brief look at it the other day out of interest and could not
establish a connection to it, either, although the propagation of
the service as such via Bonjour worked for me. This is on 10.4.3
as well. Maybe it's related.
Also, while I think about it, I had Safari to "freeze" a lot of
times in 10.4.3 when running it for a couple of days. Safari
indicated to be working on the connection while nothing happened.
Quitting Safari and restarting it always solved the issue. Firefox
never had such a problem, so this can't be owed to my connection.
If it proves to actually be a problem in CFSocket, you may want to
look into ways to work directly with BSD sockets, thus not going
through CFSocket for this purpose.
Felix
Am 25.11.2005 um 22:22 schrieb Frank Illenberger:
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.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden