Mysterious threads & ObjectAlloc crashes
Mysterious threads & ObjectAlloc crashes
- Subject: Mysterious threads & ObjectAlloc crashes
- From: Andreas Schwarz <email@hidden>
- Date: Sun, 20 Jan 2002 15:14:51 -0800
Hello all. Sorry if this is a long one!
Yesterday I attempted to use ObjectAlloc on an app I've written, but
when I tried ot run my app through OA it would merely crash while
starting up. Puzzled by this (my app runs just fine on it's own) I
searched the MacOSX-dev and Cocoa-dev digests (on a side note, why is
Apple's mailing list search so horrid?). Eventually I came upon a
cocoa-dev submission from last December in which someone else (Brian
Webster) had the same problem as I.
I was disappointed to discover, however, that his problem seemed to stem
from some bad threads in his app, because I was not making any extra
threads in my own (that early in the startup process, anyway). But
looking at his crash log reminded me to check my own, and lo and
behold - there were two extra threads in my app. My crash log was
nearly identical to Brian's:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x7c0802a6
Thread 0:
#0 0x70167608 in CFHash
#1 0x701cee9c in __CFDictionaryFindBuckets1b
#2 0x70161d30 in CFDictionaryGetValue
#3 0x70180850 in _CFApplicationPreferencesCreateValueForKey
#4 0x708365dc in -[NSUserDefaults objectForKey:]
#5 0x70c5448c in +[NSImage initialize]
#6 0x706b4650 in class_initialize
#7 0x706b5438 in _class_lookupMethodAndLoadCache
#8 0x706bac3c in objc_msgSend
#9 0x70b9dcbc in +[NSCursor _makeCursors]
#10 0x70b9dcbc in +[NSCursor _makeCursors]
#11 0x70c8d350 in -[NSApplication init]
#12 0x70c95044 in +[NSApplication sharedApplication]
#13 0x70c91e3c in NSApplicationMain
#14 0x00004680 in main
#15 0x000045a4 in _start
#16 0x000043d4 in start
Thread 1:
#0 0x70006468 in clock_sleep_trap
#1 0x70006160 in nanosleep
#2 0x72dd1564 in __OAThread
#3 0x7002054c in _pthread_body
Thread 2 Crashed:
#0 0x72dd143c in nextFrameAddress
#1 0x72dd1a0c in _OARecordAllocationEvent
#2 0x72dd16d0 in _objectalloc_logger
#3 0x70004300 in malloc_zone_malloc
#4 0x70004204 in malloc
#5 0x70010d6c in _pthread_create_suspended
#6 0x017da1fc in 0x17da1fc
#7 0x90010008 in 0x90010008
Now that I have become aware of these extra threads, I've checked in gdb
and Thread Viewer and it seems in normal execution of my program one of
these threads is always there but does nothing at all, while the other
disappears soon after my program launches (because it crashes? I'm new
at this!).
Puzzled by the appearance of the mysterious threads, I started a new
project with virtually no code and built and ran it. According to
Thread Viewer, it too spawned the two additional threads, but in this
case both survived to show up in gdb:
Mysterious Thread 1
#0 0x700343e8 in semaphore_wait_trap ()
#1 0x700342c8 in pthread_join ()
#2 0x001fc214 in ?? ()
#3 0x00000000 in ?? ()
warning: ppc_frame_chain_valid: stack pointer from 0x204fc0 to 0x13a8c0
grows upward; assuming invalid
Mysterious Thread 2
#0 0x7003f4c8 in semaphore_wait_signal_trap ()
#1 0x7003f2c8 in _pthread_cond_wait ()
#2 0x70250ab0 in TSWaitOnCondition ()
#3 0x702ae124 in MPRemoteCall ()
#4 0x001fc29c in ?? ()
#5 0x7002054c in _pthread_body ()
warning: ppc_frame_chain_valid: stack frame from 0x285eb0 to 0x702ae058
larger than 65536 bytes; assuming invalid
So my question is, is this normal? What are these threads doing?
Thinking back to an earlier incarnation of my app a few months ago, I
remember there always being only one (the main) thread in my app when I
checked in gdb, so surely these extra threads are anomalous... What
should I do about it?
Thanks for even reading this far,
Andreas Schwarz