Crashes in CFReadStreamRead()
Crashes in CFReadStreamRead()
- Subject: Crashes in CFReadStreamRead()
- From: Rich Siegel <email@hidden>
- Date: Wed, 5 Oct 2005 10:01:32 -0400
A while back, I converted all of my internal networking from Open
Transport to CFNetwork. The application is pre-emptively threaded (I'm
using the multiprocessing APIs), and within each thread, the networking
is synchronous.
In general, it's all working pretty well, but a disturbing number of
beta sites are reporting crashes in which the backtrace of the crashed
thread looks like this:
Thread 5 Crashed:
0 <<00000000>> 0xfffeff20 objc_msgSend_rtp + 32
1 com.apple.CoreFoundation 0x90749468 __CFSetFindBuckets1b + 140
2 com.apple.CoreFoundation 0x90743284 CFSetContainsValue + 204
3 com.apple.CoreFoundation 0x907597bc CFRunLoopRemoveSource + 264
4 com.apple.CFNetwork 0x90efa6ac _SocketStreamRead + 556
5 com.apple.CoreFoundation 0x9079912c CFReadStreamRead + 360
6 com.barebones.mailsmith 0x00446cc4 CFNetworkHelper::ReceiveData(long&, char const*, unsigned long*) + 820
7 com.barebones.mailsmith 0x00447004 CFNetworkHelper::ReceiveLine(char*, unsigned long) + 68
..essentially, the CFReadStreamRead() is crashing in code called from
CFRunLoopRemoveSource().
In all of the backtraces, there are in fact several CFNetwork threads
running, and the main thread is in the middle of RunCurrentEventLoop().
Here's the whole thing, with some frames at the end omitted for brevity
and to protect the innocent:
Thread 0:
0 libSystem.B.dylib 0x9000a738 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a67c mach_msg + 60
2 com.apple.CoreFoundation 0x9074b338 __CFRunLoopRun + 832
3 com.apple.CoreFoundation 0x9074ac3c CFRunLoopRunSpecific + 268
4 com.apple.HIToolbox 0x93129ac0 RunCurrentEventLoopInMode + 264
5 com.apple.HIToolbox 0x9320e768 GetNextEventMatchingMask + 400
6 com.apple.HIToolbox 0x9320e51c WNEInternal + 140
7 com.apple.HIToolbox 0x9320e47c WaitNextEvent + 76
[12 frames omitted]
Thread 1:
0 libSystem.B.dylib 0x9001efcc select + 12
1 com.apple.CoreFoundation 0x9075dbcc __CFSocketManager + 472
2 libSystem.B.dylib 0x9002c3b4 _pthread_body + 96
Thread 2:
0 <<00000000>> 0xffff85d8 __spin_lock_relinquish + 24 (cpu_capabilities.h:186)
1 com.apple.CFNetwork 0x90efa65c _SocketStreamRead + 476
2 com.apple.CoreFoundation 0x9079912c CFReadStreamRead + 360
3 com.barebones.mailsmith 0x00446cc4 CFNetworkHelper::ReceiveData(long&, char const*, unsigned long*) + 820
4 com.barebones.mailsmith 0x00447004 CFNetworkHelper::ReceiveLine(char*, unsigned long) + 68
5 com.barebones.mailsmith 0x003eda2c CSmtp::AuthLogin(char*, char*) + 4444
6 com.barebones.mailsmith 0x003ef010 CSmtp::Authenticate(bool, char*, char*) + 248
[6 frames omitted]
Thread 3:
0 libSystem.B.dylib 0x9000a738 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a67c mach_msg + 60
2 com.apple.CoreFoundation 0x9074b338 __CFRunLoopRun + 832
3 com.apple.CoreFoundation 0x9074ac3c CFRunLoopRunSpecific + 268
4 com.apple.CFNetwork 0x90efa654 _SocketStreamRead + 468
5 com.apple.CoreFoundation 0x9079912c CFReadStreamRead + 360
6 com.barebones.mailsmith 0x00446cc4 CFNetworkHelper::ReceiveData(long&, char const*, unsigned long*) + 820
7 com.barebones.mailsmith 0x00447004 CFNetworkHelper::ReceiveLine(char*, unsigned long) + 68
8 com.barebones.mailsmith 0x003e7e88 CPop::SendCommand(char const*, char const*) + 140
[6 frames omitted]
Thread 4:
0 libSystem.B.dylib 0x9000a738 mach_msg_trap + 8
1 libSystem.B.dylib 0x9000a67c mach_msg + 60
2 com.apple.CoreFoundation 0x9074b338 __CFRunLoopRun + 832
3 com.apple.CoreFoundation 0x9074ac3c CFRunLoopRunSpecific + 268
4 com.apple.CFNetwork 0x90efa654 _SocketStreamRead + 468
5 com.apple.CoreFoundation 0x9079912c CFReadStreamRead + 360
6 com.barebones.mailsmith 0x00446cc4 CFNetworkHelper::ReceiveData(long&, char const*, unsigned long*) + 820
7 com.barebones.mailsmith 0x00447004 CFNetworkHelper::ReceiveLine(char*, unsigned long) + 68
8 com.barebones.mailsmith 0x003e7e88 CPop::SendCommand(char const*, char const*) + 140
[6 frames omitted]
Thread 5 Crashed:
0 <<00000000>> 0xfffeff20 objc_msgSend_rtp + 32
1 com.apple.CoreFoundation 0x90749468 __CFSetFindBuckets1b + 140
2 com.apple.CoreFoundation 0x90743284 CFSetContainsValue + 204
3 com.apple.CoreFoundation 0x907597bc CFRunLoopRemoveSource + 264
4 com.apple.CFNetwork 0x90efa6ac _SocketStreamRead + 556
5 com.apple.CoreFoundation 0x9079912c CFReadStreamRead + 360
6 com.barebones.mailsmith 0x00446cc4 CFNetworkHelper::ReceiveData(long&, char const*, unsigned long*) + 820
7 com.barebones.mailsmith 0x00447004 CFNetworkHelper::ReceiveLine(char*, unsigned long) + 68
[7 frames omitted]
Is it possible that running CFNetwork synchronously on multiple threads
is a bad idea? Could there be a bug in CFNetwork or CFRunLoop in which a
shared data structure is being mangled? Do I have a bug? (Always a
possibility.)
Thanks for any advice,
R.
--
Rich Siegel Bare Bones Software, Inc.
<email@hidden> <http://www.barebones.com/>
Someday I'll look back on all this and laugh... until they sedate me.
_______________________________________________
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