NSCache / libcache BIG BAD deadlock
Originator: | me | ||
Number: | rdar://10916098 | Date Originated: | 22-Feb-2012 06:18 PM |
Status: | Open | Resolved: | |
Product: | Mac OS X | Product Version: | 10.7.3 (11D50) |
Classification: | Crash/Hang/Data Loss | Reproducible: | I Didn't Try |
I hit what appears to be a deadlock situation, creating an NSCache while a background queue is destroying one. I paused the app after it spun for about 5 seconds. After examining the state in the debugger for a while, the app received SIGABRT. I suspect someone else on the system sent that (since it would apparently have failed to react to the memory pressure warning?). That crash report is attached. Thread 1 is creating an NSCache instance with +[NSCache new] (frame 4). LIFancyCoverCache is not an NSCache subclass, btw. It appears that Thread 1 and Thread 13 are messaging two different cache instances: <NSCache: 0x10f17c1d0> on Thread 1, <NSCache: 0x10c4f3590> on Thread 13. (At least, that's what were in $rbx on each thread.) Here are the backtraces for the two threads in question. The backtrace of all threads is a separate attachment. Thread 1, Queue : com.apple.main-thread #0 0x00007fff88e2abf2 in __psynch_mutexwait () #1 0x00007fff8dca51a1 in pthread_mutex_lock () #2 0x00007fff90548905 in cache_create () #3 0x00007fff947f1a9c in -[NSCache init] () #4 0x00007fff947cb3b2 in +[NSObject new] () #5 0x000000010026cc4a in -[LIFancyCoverCache init] at /Users/jonathon/Documents/Streams/Delicious Monster/UberLibrary/Library/LIFancyCoverCache.m:39 #6 0x00007fff947cb3b2 in +[NSObject new] () #7 0x000000010026cf92 in +[LIFancyCoverCache fancyCoverCacheForSize:] () #8 0x000000010025ecce in -[LICoverImageView drawRect:] () #9 0x00007fff8ce09abe in -[NSView _drawRect:clip:] () #10 0x00007fff8ce371eb in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #11 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #12 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #13 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #14 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #15 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #16 0x00007fff8ce37617 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] () #17 0x00007fff8ce07099 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #18 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #19 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #20 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #21 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #22 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #23 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #24 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #25 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #26 0x00007fff8ce0834e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #27 0x00007fff8ce06593 in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] () #28 0x00007fff8ce019af in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] () #29 0x00007fff8cdfa429 in -[NSView displayIfNeeded] () #30 0x00007fff8cdf9b69 in _handleWindowNeedsDisplayOrLayoutOrUpdateConstraints () #31 0x00007fff947e4bd7 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ () #32 0x00007fff947e4b36 in __CFRunLoopDoObservers () #33 0x00007fff947b9ce9 in __CFRunLoopRun () #34 0x00007fff947b9676 in CFRunLoopRunSpecific () #35 0x00007fff8fd2731f in RunCurrentEventLoopInMode () #36 0x00007fff8fd2e5c9 in ReceiveNextEventCommon () #37 0x00007fff8fd2e456 in BlockUntilNextEventMatchingListInMode () #38 0x00007fff8cdbdf5d in _DPSNextEvent () #39 0x00007fff8cdbd861 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #40 0x00007fff8cdba19d in -[NSApplication run] () #41 0x00007fff8d038b88 in NSApplicationMain () #42 0x0000000100002c87 in main () Thread 2, Queue : com.apple.libdispatch-manager Thread 7, Queue : (null) Thread 11 CVDisplayLink, Queue : (null) Thread 13, Queue : com.apple.root.default-priority #0 0x00007fff88e2abf2 in __psynch_mutexwait () #1 0x00007fff8dca51a1 in pthread_mutex_lock () #2 0x00007fff9054792a in cache_destroy () #3 0x00007fff948c39db in -[NSCache dealloc] () #4 0x00007fff94789ca0 in CFRelease () #5 0x00007fff905468e4 in _value_entry_remove () #6 0x00007fff905469cd in _entry_unmap () #7 0x00007fff90546a71 in _entry_evict () #8 0x00007fff90546b04 in _evict_last () #9 0x00007fff90546cf2 in _cache_enforce_limits () #10 0x00007fff90546ea5 in cache_handle_memory_pressure () #11 0x00007fff8a7d92b6 in _dispatch_source_invoke () #12 0x00007fff8a7d5f77 in _dispatch_queue_invoke () #13 0x00007fff8a7d5760 in _dispatch_worker_thread2 () #14 0x00007fff8dca83da in _pthread_wqthread () #15 0x00007fff8dca9b85 in start_wqthread () Thread 17 QTKit: QTCALayerRendererPendingQWorkLoop, Queue : (null) Thread 19 com.apple.NSURLConnectionLoader, Queue : (null) Thread 21 com.apple.CFSocket.private, Queue : (null) Thread 27, Queue : (null) Thread 28, Queue : (null)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
And again, while doing a parallel computation in the same app as before:
06-Mar-2012 03:24 AM Jonathon Mah:
06-Mar-2012 03:24 AM Jonathon Mah:
In recent days I've seen this two additional times. The first happened at the same place. The second happened in a completely different project, which was accessing an NSCache. It had been open for a while and I suspect reactivating it caused it to grab some memory, but no real RAM was free at the time, giving a memory warning and paging.