CFNetwork crash!
CFNetwork crash!
- Subject: CFNetwork crash!
- From: Avi Drissman <email@hidden>
- Date: Tue, 16 Jul 2002 09:42:40 -0400
I'm tracking down a crash with my CFNetwork/CFStream server.
What's happening is that a client connects and then immediately
disconnects. My CFSocket gets an kCFSocketAcceptCallBack callback. It
creates a CFStream pair, builds some data structures, and returns.
The read stream's socket callback then gets a
kCFStreamEventHasBytesAvailable call. (This is Puma.)
We read the data, and find 0 bytes available. The function to read
the data is called from the callback, and currently cannot tell the
callback this fact. (This is an architectural limitation in my app
that, at the moment, I don't see how to fix.) So the callback calls
CFReadStreamGetStatus() on the stream, finds it in either the
kCFStreamStatusAtEnd or the kCFStreamStatusError state (I don't know
which) and breaks down the stream.
It does:
-----8<-----
CFReadStreamSetClient(otEndpointPtr->readStream, 0, nil, nil);
CFReadStreamUnscheduleFromRunLoop(otEndpointPtr->readStream,
gMainRunLoop, kCFRunLoopCommonModes);
CFReadStreamClose(otEndpointPtr->readStream);
CFRelease(otEndpointPtr->readStream);
otEndpointPtr->readStream = nil;
CFWriteStreamSetClient(otEndpointPtr->writeStream, 0, nil, nil);
CFWriteStreamUnscheduleFromRunLoop(otEndpointPtr->writeStream,
gMainRunLoop, kCFRunLoopCommonModes);
CFWriteStreamClose(otEndpointPtr->writeStream);
CFRelease(otEndpointPtr->writeStream);
otEndpointPtr->writeStream = nil;
-----8<-----
It then returns.
At which point CFNetwork explodes.
-----8<-----
Date/Time: 2002-07-15 16:00:47 -0400
OS Version: 10.1.5 (Build 5S66)
Host: avi.baseview.com
Command: IQue Server
PID: 472
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x40480862
Thread 0 Crashed:
#0 0x706bab68 in objc_msgSend
#1 0x70162cec in CFRetain
#2 0x701e3748 in socketCallBack
#3 0x70196908 in __CFSocketPerform
#4 0x7017c848 in __CFRunLoopDoSources0
#5 0x7017bde4 in __CFRunLoopRun
#6 0x701b70ec in CFRunLoopRunSpecific
#7 0x7017b8cc in CFRunLoopRunInMode
#8 0x7312d904 in RunEventLoopInModeUntilEventArrives
#9 0x731c2bcc in RunEventLoopUntilEventArrives
#10 0x731a145c in GetNextEventMatchingMask
#11 0x731ae418 in WNEInternal
#12 0x731c5518 in WaitNextEvent
#13 0x00007080 in _Z11doEventLoopv
#14 0x00003fc4 in main
#15 0x00003efc in _start
#16 0x00003d2c in start
Thread 1:
...
Thread 2:
...
Thread 3:
...
Thread 4:
...
Thread 5:
...
Thread 6:
...
Thread 7:
...
Thread 8:
...
Thread 9:
...
Thread 10:
...
Thread 11:
...
Thread 12:
...
Thread 13:
#0 0x700252fc in select
#1 0x701955e8 in __CFSocketManager
#2 0x7002054c in _pthread_body
Thread 14:
...
PPC Thread State:
srr0: 0x706bab68 srr1: 0x0200f030 vrsave: 0x00000000
xer: 0x20000018 lr: 0x70162cec ctr: 0x706bab4c mq: 0x00000000
r0: 0x70162cd4 r1: 0xbffff2d0 r2: 0x000000d4 r3: 0x0519f9c0
r4: 0x706cf57c r5: 0x806b0714 r6: 0x00000001 r7: 0x00000003
r8: 0x701e6a54 r9: 0x00000000 r10: 0x00002798 r11: 0x00000006
r12: 0x40480862 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000
r16: 0x00000001 r17: 0x00000000 r18: 0x00000000 r19: 0x0000f4eb
r20: 0x00000000 r21: 0x00000001 r22: 0x0000000d r23: 0x00000001
r24: 0x00000000 r25: 0x05193c5c r26: 0x00000001 r27: 0x00000000
r28: 0x0519f9c0 r29: 0x706bab4c r30: 0x801608b0 r31: 0x70162c3c
-----8<-----
It seems to be dying because socketCallBack is trying to retain a
disposed object. Am I not allowed to dispose the CFStreams in the
callback? If not, when am I supposed to?
Avi
--
Avi Drissman
email@hidden
Argh! This darn mail server is trunca
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.