Created
August 9, 2012 17:54
-
-
Save bewebste/3306504 to your computer and use it in GitHub Desktop.
Am I crazy, or will this function always hang if it hits that dispatch_sync_f() call?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is some LLDB output from my app in a hung state somewhere deep in the image rendering frameworks. It looks like it's hung on dispatch_sync_f(), and from what I can tell from the disassembly, it looks like it's dispatching it on the current queue (see the call to dispatch_get_current_queue() just a few instructions prior), which the docs say will always hang. | |
(lldb) bt | |
* thread #1: tid = 0x2203, 0x00007fff88b4f6c2 libsystem_kernel.dylib`semaphore_wait_trap + 10, stop reason = signal SIGSTOP | |
frame #0: 0x00007fff88b4f6c2 libsystem_kernel.dylib`semaphore_wait_trap + 10 | |
frame #1: 0x00007fff88924c6e libdispatch.dylib`_dispatch_thread_semaphore_wait + 16 | |
frame #2: 0x00007fff88924ace libdispatch.dylib`_dispatch_barrier_sync_f_slow + 188 | |
frame #3: 0x00007fff89387efb OpenCL`clFinish + 120 | |
frame #4: 0x00007fff8e5d5d3d CoreImage`-[FEOpenCLContext _quad:] + 3743 | |
frame #5: 0x00007fff8e6ce18e CoreImage`-[FEContext(Drawing) quad:kernel:] + 107 | |
frame #6: 0x00007fff8e6114ae CoreImage`FEApplyTreeNode::render1(FETreeContext*, FEShape const&, fe_kernel_target_struct*, int, float*, FETreeTexture*) + 2712 | |
frame #7: 0x00007fff8e611c65 CoreImage`FEApplyTreeNode::render2(FETreeContext*, FEShape const*, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 1583 | |
frame #8: 0x00007fff8e60ecf7 CoreImage`FETreeNode::render_(FETreeContext*, FEShape const*, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 169 | |
frame #9: 0x00007fff8e6129f5 CoreImage`FETreeNode::render(FETreeContext*, FEShape const&, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 107 | |
frame #10: 0x00007fff8e616741 CoreImage`FETreeContext::renderTree(FETreeNode*, FEShape const&, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 277 | |
frame #11: 0x00007fff8e616a65 CoreImage`FETreeContext::renderImage_(FEImage*, CGRect, FEShape const*, CGAffineTransform, CGColorSpace*, FEFormat, bool, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 703 | |
frame #12: 0x00007fff8e616e41 CoreImage`FETreeContext::renderImage(FEImage*, CGRect, FEShape const*, CGAffineTransform, CGColorSpace*, FEFormat, bool, void (*)(FEContext*, void*, FEFormat), void (*)(FEContext*, void*), void*) + 459 | |
frame #13: 0x00007fff8e5ed6d6 CoreImage`-[FEImage(Internal) _renderWithContext:bounds:transform:colorSpace:format:premultiplied:setupCallback:finishCallback:callbackData:] + 339 | |
frame #14: 0x00007fff8e5ecaef CoreImage`-[FEImage getBitmap:withContext:origin:transform:colorSpace:] + 694 | |
frame #15: 0x00007fff8e5a1e4a CoreImage`-[CIContextImpl render:toBitmap:rowBytes:bounds:format:colorSpace:] + 427 | |
frame #16: 0x00007fff8e5a0d18 CoreImage`-[CIContext render:toBitmap:rowBytes:bounds:format:colorSpace:] + 77 | |
frame #17: 0x00007fff893636f6 libCGXCoreImage.A.dylib`cgxcoreimage_instance_render + 2264 | |
frame #18: 0x00007fff89362d31 libCGXCoreImage.A.dylib`cgxcoreimage_provider_create_byte_pointer + 126 | |
frame #19: 0x00007fff83f50729 CoreGraphics`CGAccessSessionGetBytePointer + 49 | |
frame #20: 0x00007fff83f95b0e CoreGraphics`img_decode_read + 184 | |
frame #21: 0x00007fff83f9595e CoreGraphics`img_colormatch_read + 346 | |
frame #22: 0x00007fff83f9579a CoreGraphics`img_alphamerge_read + 551 | |
frame #23: 0x00007fff83f7784d CoreGraphics`img_data_lock + 7109 | |
frame #24: 0x00007fff83f74dfa CoreGraphics`CGSImageDataLock + 193 | |
frame #25: 0x00007fff90247ba9 libRIP.A.dylib`ripc_AcquireImage + 2468 | |
frame #26: 0x00007fff90246709 libRIP.A.dylib`ripc_DrawImage + 1045 | |
frame #27: 0x00007fff83f7492f CoreGraphics`CGContextDrawImage + 460 | |
frame #28: 0x00007fff8546396a CoreUI`CUIPenCG::DrawImage(void*, CGRect, void*) + 54 | |
frame #29: 0x00007fff8546c624 CoreUI`CUIArtFileRenderer::DrawImage(CGRect, long, CUIDescriptor const*) + 10558 | |
frame #30: 0x00007fff8545a90f CoreUI`CUIArtFileRenderer::Draw(CUIDescriptor const*, CGAffineTransform, CUIReturnInfo&) + 1571 | |
frame #31: 0x00007fff854359e1 CoreUI`CUIRenderer::Draw(CGRect, CGContext*, __CFDictionary const*, __CFDictionary const**) + 3343 | |
frame #32: 0x00007fff85460c4b CoreUI`CUIDraw + 180 | |
frame #33: 0x00007fff87822a2f AppKit`-[NSCoreUIImageRep draw] + 260 | |
frame #34: 0x00007fff878228b1 AppKit`-[NSImageRep drawInRect:] + 384 | |
frame #35: 0x00007fff87b8ec5c AppKit`__block_global_0 + 64 | |
frame #36: 0x00007fff878225a4 AppKit`NSGraphicsContextPushContextWithFlippedMetadata_drawWithBlock_ + 312 | |
frame #37: 0x00007fff878222c5 AppKit`__74-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_0 + 1686 | |
frame #38: 0x00007fff87821a18 AppKit`-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] + 1070 | |
frame #39: 0x00007fff8781fcb1 AppKit`-[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] + 2375 | |
frame #40: 0x00007fff878e3b30 AppKit`-[NSImageCell _drawImageWithFrame:inView:] + 228 | |
frame #41: 0x00007fff878e34e2 AppKit`-[NSImageCell drawInteriorWithFrame:inView:] + 627 | |
frame #42: 0x000000010008a5fe iPhoto Library Manager`-[IPListItemCell drawInteriorWithFrame:inView:] + 942 at IPListItemCell.m:171 | |
frame #43: 0x00007fff87939d9e AppKit`-[NSTableView drawRow:clipRect:] + 2131 | |
frame #44: 0x00007fff87929c93 AppKit`-[NSTableView drawRowIndexes:clipRect:] + 397 | |
frame #45: 0x00007fff87928676 AppKit`-[NSTableView drawRect:] + 1269 | |
frame #46: 0x00007fff8780ca94 AppKit`-[NSView _drawRect:clip:] + 4217 | |
frame #47: 0x00007fff8780b0f1 AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1656 | |
frame #48: 0x00007fff8780b509 AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2704 | |
frame #49: 0x00007fff87809122 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 817 | |
frame #50: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #51: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #52: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #53: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #54: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #55: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #56: 0x00007fff8780a474 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5763 | |
frame #57: 0x00007fff87808b73 AppKit`-[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 314 | |
frame #58: 0x00007fff8780479d AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4675 | |
frame #59: 0x00007fff877ce703 AppKit`-[NSView displayIfNeeded] + 1830 | |
frame #60: 0x00007fff877cdc3c AppKit`_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 738 | |
frame #61: 0x00007fff87d95c81 AppKit`__83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208 + 46 | |
frame #62: 0x00007fff8529e0c7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 | |
frame #63: 0x00007fff8529e031 CoreFoundation`__CFRunLoopDoObservers + 369 | |
frame #64: 0x00007fff852794a8 CoreFoundation`__CFRunLoopRun + 728 | |
frame #65: 0x00007fff85278dd2 CoreFoundation`CFRunLoopRunSpecific + 290 | |
frame #66: 0x00007fff9034b774 HIToolbox`RunCurrentEventLoopInMode + 209 | |
frame #67: 0x00007fff9034b512 HIToolbox`ReceiveNextEventCommon + 356 | |
frame #68: 0x00007fff9034b3a3 HIToolbox`BlockUntilNextEventMatchingListInMode + 62 | |
frame #69: 0x00007fff877cafa3 AppKit`_DPSNextEvent + 685 | |
frame #70: 0x00007fff877ca862 AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128 | |
frame #71: 0x00007fff877c1c03 AppKit`-[NSApplication run] + 517 | |
frame #72: 0x00007fff87766656 AppKit`NSApplicationMain + 869 | |
frame #73: 0x000000010004a392 iPhoto Library Manager`main + 34 at main.m:23 | |
frame #74: 0x0000000100002014 iPhoto Library Manager`start + 52 | |
(lldb) frame select 3 | |
frame #3: 0x00007fff89387efb OpenCL`clFinish + 120 | |
OpenCL`clFinish + 120: | |
-> 0x7fff89387efb: jmp 0x7fff89387f06 ; clFinish + 131 | |
0x7fff89387efd: leaq -32(%rbp), %rdi | |
0x7fff89387f01: callq 0x7fff89387e02 ; ___lldb_unnamed_function434$$OpenCL | |
0x7fff89387f06: testb $1, 136(%rbx) | |
(lldb) disassemble -f | |
OpenCL`clFinish: | |
0x7fff89387e83: pushq %rbp | |
0x7fff89387e84: movq %rsp, %rbp | |
0x7fff89387e87: pushq %r14 | |
0x7fff89387e89: pushq %rbx | |
0x7fff89387e8a: subq $16, %rsp | |
0x7fff89387e8e: movq %rdi, %rbx | |
0x7fff89387e91: movq %rbx, %rdi | |
0x7fff89387e94: callq 0x7fff89372b4e ; ___lldb_unnamed_function288$$OpenCL | |
0x7fff89387e99: movl $4294967260, %r14d | |
0x7fff89387e9f: testq %rax, %rax | |
0x7fff89387ea2: je 0x7fff89387f13 ; clFinish + 144 | |
0x7fff89387ea4: testb $1, 136(%rbx) | |
0x7fff89387eab: jne 0x7fff89387ecf ; clFinish + 76 | |
0x7fff89387ead: movq 112(%rbx), %rdi | |
0x7fff89387eb1: movl $4294967260, %r14d | |
0x7fff89387eb7: leaq 140054(%rip), %rdx ; "clFinish failed: queue (%p) has been invalidated." | |
0x7fff89387ebe: movl $4294967260, %esi | |
0x7fff89387ec3: movq %rbx, %rcx | |
0x7fff89387ec6: xorb %al, %al | |
0x7fff89387ec8: callq 0x7fff89371ffc ; ___lldb_unnamed_function274$$OpenCL | |
0x7fff89387ecd: jmp 0x7fff89387f13 ; clFinish + 144 | |
0x7fff89387ecf: movq %rbx, -32(%rbp) | |
0x7fff89387ed3: movl $0, -24(%rbp) | |
0x7fff89387eda: movq 120(%rbx), %r14 | |
0x7fff89387ede: callq 0x7fff8939fc1e ; symbol stub for: dispatch_get_current_queue | |
0x7fff89387ee3: cmpq %rax, %r14 | |
0x7fff89387ee6: je 0x7fff89387efd ; clFinish + 122 | |
0x7fff89387ee8: leaq -32(%rbp), %rsi | |
0x7fff89387eec: leaq -241(%rip), %rdx ; ___lldb_unnamed_function434$$OpenCL | |
0x7fff89387ef3: movq %r14, %rdi | |
0x7fff89387ef6: callq 0x7fff8939fc48 ; symbol stub for: dispatch_sync_f | |
-> 0x7fff89387efb: jmp 0x7fff89387f06 ; clFinish + 131 | |
0x7fff89387efd: leaq -32(%rbp), %rdi | |
0x7fff89387f01: callq 0x7fff89387e02 ; ___lldb_unnamed_function434$$OpenCL | |
0x7fff89387f06: testb $1, 136(%rbx) | |
0x7fff89387f0d: je 0x7fff89387ead ; clFinish + 42 | |
0x7fff89387f0f: movl -24(%rbp), %r14d | |
0x7fff89387f13: movl %r14d, %eax | |
0x7fff89387f16: addq $16, %rsp | |
0x7fff89387f1a: popq %rbx | |
0x7fff89387f1b: popq %r14 | |
0x7fff89387f1d: popq %rbp | |
0x7fff89387f1e: ret | |
(lldb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examining things further, there is also an IKImageBrowserView with a whole bunch of background tasks waiting on the main thread, so I'm thinking that might just be clogging up the default dispatch queue, and not allowing this dispatch_sync_f() to sneak in anywhere.