Re: Crash in CFRunLoopWakeUp
On 4 Sep 2009, at 12:04 am, Greg Parker wrote: On Sep 3, 2009, at 3:41 PM, Mark Allan wrote: I've been battling with this intermittent crash for about two weeks now and can't figure it out for the life of me. I've got try/catch blocks around nearly all my code, and definitely around any code which runs in a separate thread, but it's not catching whatever causes this crash. Also, I'm not even convinced it's my threads causing the crash as this one happened while a modal sheet was being displayed, before any of my external threads got started. Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0001, 0x90d5c02c Crashed Thread: 6 Thread 6 Crashed: 0 com.apple.CoreFoundation0x90d5c02c CFRunLoopWakeUp + 156 1 com.apple.Foundation 0x903ad0e4 _backgroundActivity + 440 EXC_BREAKPOINT means the process deliberately killed itself (including `int3` on i386, `trap` on ppc, `__builtin_trap()` in gcc). In the case of CFRunLoopWakeUp(), it's halting because it tried and failed to send a Mach message to that run loop. Most likely this means the target run loop has already been deleted, but other Mach messaging problems are possible. _backgroundActivity is part of NSFileHandle, to perform things like - readInBackgroundAndNotify. Perhaps there's bad memory management of an NSFileHandle somewhere. Thank you so much for your answer. It turns out one of my threads was running after all and I think what was happening was that the NSTask started by my second thread was completing so quickly that the thread (and hence the run loop) was disappearing before some notification was being sent/received. I was under the impression that the waitUntilExit method was supposed to prevent this from happening, but it doesn't appear to be doing so reliably. Anyway, I've now moved all my -release calls into the object's dealloc method, removed the -waitUntilExit call and the NSTask is now being started from the main run loop. Hopefully that covers all the bases. Because it's an intermittent bug, it'll be a while before I can be sure I've managed to squash it once and for all, but initial reports look good :) Thanks again Mark ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash in CFRunLoopWakeUp
On Sep 3, 2009, at 3:41 PM, Mark Allan wrote: I've been battling with this intermittent crash for about two weeks now and can't figure it out for the life of me. I've got try/catch blocks around nearly all my code, and definitely around any code which runs in a separate thread, but it's not catching whatever causes this crash. Also, I'm not even convinced it's my threads causing the crash as this one happened while a modal sheet was being displayed, before any of my external threads got started. Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0001, 0x90d5c02c Crashed Thread: 6 Thread 6 Crashed: 0 com.apple.CoreFoundation0x90d5c02c CFRunLoopWakeUp + 156 1 com.apple.Foundation 0x903ad0e4 _backgroundActivity + 440 EXC_BREAKPOINT means the process deliberately killed itself (including `int3` on i386, `trap` on ppc, `__builtin_trap()` in gcc). In the case of CFRunLoopWakeUp(), it's halting because it tried and failed to send a Mach message to that run loop. Most likely this means the target run loop has already been deleted, but other Mach messaging problems are possible. _backgroundActivity is part of NSFileHandle, to perform things like - readInBackgroundAndNotify. Perhaps there's bad memory management of an NSFileHandle somewhere. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Crash in CFRunLoopWakeUp
Hi all, I've been battling with this intermittent crash for about two weeks now and can't figure it out for the life of me. I've got try/catch blocks around nearly all my code, and definitely around any code which runs in a separate thread, but it's not catching whatever causes this crash. Also, I'm not even convinced it's my threads causing the crash as this one happened while a modal sheet was being displayed, before any of my external threads got started. I'm fairly sure it's not a leak or a double-free - I've tried running with NSZombieEnabled, NSDebugEnabled, Malloc Guard, run the Clang Static Analyser over it and it's not showing anything up. If I set NSExceptionHandlingMask to 63 in the terminal before launching my app, I get the following lines appearing in the console when a crash would have happened, and the application keeps running. The problem is, I can't seem to catch the exception anywhere. NSExceptionHandler has recorded the following exception: NSUncaughtSystemExceptionException -- Uncaught system exception: signal 5 Stack trace: 0x94f340a9 0x95294e3b 0x94f33b11 0xc0f2a 0xc121e 0x911502bb 0x 0x932e2556 0x91115155 0x91115012 Here's the crash log I mentioned earlier. It's an intermittent crash and I'm going crazy trying to debug it. Can anyone offer me any insight at all please? Should I just burn an ADC support ticket and be done with it? Many thanks for any help or suggestions you can give me. Mark Version: 2.0 (200) Code Type: PPC (Native) Parent Process: launchd [65] Date/Time: 2009-08-27 11:32:25.003 -0700 OS Version: Mac OS X 10.5.8 (9L30) Report Version: 6 Anonymous UUID: Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0001, 0x90d5c02c Crashed Thread: 6 Thread 0: 0 libSystem.B.dylib 0x95ece1f8 mach_msg_trap + 8 1 libSystem.B.dylib 0x95ed511c mach_msg + 56 2 com.apple.CoreFoundation 0x90d61394 CFRunLoopRunSpecific + 1812 3 com.apple.HIToolbox 0x938a3b14 RunCurrentEventLoopInMode + 264 4 com.apple.HIToolbox 0x938a3938 ReceiveNextEventCommon + 412 5 com.apple.HIToolbox 0x938ead04 IsUserStillTracking(MenuSelectData*, unsigned char*) + 472 6 com.apple.HIToolbox 0x938d47a0 TrackMenuCommon(MenuSelectData&, unsigned char*) + 3180 7 com.apple.HIToolbox 0x938cf854 MenuSelectCore(MenuData*, Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) + 228 8 com.apple.HIToolbox 0x938cf3bc _HandleMenuSelection2 + 388 9 com.apple.AppKit 0x93147c54 _NSHandleCarbonMenuEvent + 188 10 com.apple.AppKit0x930bd728 _DPSNextEvent + 1848 11 com.apple.AppKit 0x930bcbfc -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 112 12 com.apple.AppKit0x930b689c -[NSApplication run] + 744 13 com.apple.AppKit0x93087298 NSApplicationMain + 440 14 uk.co.markallan.myapp 0x27f8 _start + 756 15 uk.co.markallan.myapp 0x24fc start + 44 Thread 1: 0 libSystem.B.dylib 0x95ece278 semaphore_timedwait_signal_trap + 8 1 libSystem.B.dylib 0x95f11368 _pthread_cond_wait + 1320 2 com.apple.Foundation 0x9037f1a0 -[NSCondition waitUntilDate:] + 384 3 com.apple.Foundation 0x9037efcc -[NSConditionLock lockWhenCondition:beforeDate:] + 268 4 com.apple.AppKit 0x931189cc -[NSUIHeartBeat _heartBeatThread:] + 664 5 com.apple.Foundation0x90341d84 __NSThread__main__ + 1004 6 libSystem.B.dylib 0x95f100c4 _pthread_start + 316 Thread 2: 0 libSystem.B.dylib 0x95ece1f8 mach_msg_trap + 8 1 libSystem.B.dylib 0x95ed511c mach_msg + 56 2 com.apple.CoreFoundation 0x90d61394 CFRunLoopRunSpecific + 1812 3 com.apple.Foundation 0x90398d50 + [NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 280 4 com.apple.Foundation0x90341d84 __NSThread__main__ + 1004 5 libSystem.B.dylib 0x95f100c4 _pthread_start + 316 Thread 3: 0 libSystem.B.dylib 0x95ece1f8 mach_msg_trap + 8 1 libSystem.B.dylib 0x95ed511c mach_msg + 56 2 com.apple.CoreFoundation 0x90d61394 CFRunLoopRunSpecific + 1812 3 com.apple.CFNetwork 0x94de63b0 CFURLCacheWorkerThread(void*) + 288 4 libSystem.B.dylib 0x95f100c4 _pthread_start + 316 Thread 4: 0 libSystem.B.dylib 0x95f31d74 select$DARWIN_EXTSN + 12 1 com.apple.CoreFoundation0x90d6c808 __CFSocketManager + 764 Thread 5: 0 libSystem.B.dylib 0x95f0f904 kevent + 12 1 com.apple.CoreFoundation 0x90d38a48 __monitor_file_descriptor__ + 240 Thread 6