Thread Deadlock

  • Hi all,

    A user reported our app "froze" and had to be force quit, and provided this trace from the crash report.

    It looks to me to be a classic thread deadlock in the bowels of the kernel - can anyone comment? Is there anything we can do about this sort of thing, or just file a bug and hope?

    --Graham

    Report (significantly truncated for size)

    OS Version:      10.7.3 (Build 11D50b)
    Architecture:    x86_64
    Report Version:  9

    Parent:          launchd [150]

    PID:            1135
    Event:          hang
    Duration:        5.24s
    Steps:          51 (100ms sampling interval)

                                            51 -[NSMenu _populateFromDelegateWithEventRef:] + 213 (in AppKit) [0x7fff8ba8dd7f]
                                              51 -[NSDocumentControllerOpenRecentMenuDelegate updateMenu:withEvent:withFlags:] + 45 (in AppKit) [0x7fff8bb102c3]
                                                51 -[NSDocumentController(NSInternal) _populateOpenRecentMenu:includingIcons:] + 111 (in AppKit) [0x7fff8bced0ab]
                                                  51 -[NSDocumentController(NSPrivate) _recentDocumentURLsForKey:] + 146 (in AppKit) [0x7fff8bcf1813]
                                                    51 -[NSDocumentController _notePendingRecentDocumentURLsForKey:] + 75 (in AppKit) [0x7fff8bce4f94]
                                                      51 -[NSDocumentController maximumRecentDocumentCount] + 169 (in AppKit) [0x7fff8bb5935a]
                                                        51 _LSGetRecentItemCount + 55 (in LaunchServices) [0x7fff9397a330]
                                                          51 LSSharedFileListCopyProperty + 219 (in LaunchServices) [0x7fff9397a4f9]
                                                            51 _SFLGetMaxItemCount + 25 (in OSServices) [0x7fff8e83e287]
                                                              51 __psynch_mutexwait + 10 (in libsystem_kernel.dylib) [0x7fff8eae6bf2]
    Kernel stack:
    51 lo64_unix_scall + 23 (in mach_kernel) [0x2e4977]
      51 unix_syscall64 + 554 (in mach_kernel) [0x5f166a]
        51 psynch_mutexwait + 1450 (in mach_kernel) [0x5c4cba]
          51 ksyn_block_thread_locked + 77 (in mach_kernel) [0x5beddd]
            51 thread_block + 33 (in mach_kernel) [0x22f771]
              51 thread_block_reason + 331 (in mach_kernel) [0x22f62b]
                51 thread_continue + 1729 (in mach_kernel) [0x22f3a1]
                  51 machine_switch_context + 582 (in mach_kernel) [0x2cba26]

    Thread 0x65b57      DispatchQueue 2
    User stack:
    51 _dispatch_mgr_thread + 54 (in libdispatch.dylib) [0x7fff89b9e14e]
      51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    Kernel stack:
    51 kqueue_scan + 480 (in mach_kernel) [0x559740]

    Thread 0x66e05
    User stack:
    51 thread_start + 13 (in libsystem_c.dylib) [0x7fff8b6f0b75]
      51 _pthread_start + 335 (in libsystem_c.dylib) [0x7fff8b6ed8bf]
        51 __NSThread__main__ + 1575 (in Foundation) [0x7fff8feb06c6]
          51 -[NSThread main] + 68 (in Foundation) [0x7fff8feb074e]
            51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    Kernel stack:
    51 kqueue_scan + 480 (in mach_kernel) [0x559740]

    Thread 0x78af7
    User stack:
    46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
      46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    Kernel stack:
    46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]

    Thread 0x78af8
    User stack:
    46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
      46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    Kernel stack:
    46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
  • It's not necessarily deadlocked, but it is definitely blocked. Please log a bug for NSDocument, and include any spin reports and ideally any way to reproduce it (if possible).

    corbin

    On May 14, 2012, at 4:44 PM, Graham Cox <graham.cox...> wrote:

    > Hi all,
    >
    > A user reported our app "froze" and had to be force quit, and provided this trace from the crash report.
    >
    > It looks to me to be a classic thread deadlock in the bowels of the kernel - can anyone comment? Is there anything we can do about this sort of thing, or just file a bug and hope?
    >
    >
    > --Graham
    >
    > Report (significantly truncated for size)
    >
    >
    > OS Version:      10.7.3 (Build 11D50b)
    > Architecture:    x86_64
    > Report Version:  9
    >
    > Parent:          launchd [150]
    >
    > PID:            1135
    > Event:          hang
    > Duration:        5.24s
    > Steps:          51 (100ms sampling interval)
    >
    >
    > 51 -[NSMenu _populateFromDelegateWithEventRef:] + 213 (in AppKit) [0x7fff8ba8dd7f]
    > 51 -[NSDocumentControllerOpenRecentMenuDelegate updateMenu:withEvent:withFlags:] + 45 (in AppKit) [0x7fff8bb102c3]
    > 51 -[NSDocumentController(NSInternal) _populateOpenRecentMenu:includingIcons:] + 111 (in AppKit) [0x7fff8bced0ab]
    > 51 -[NSDocumentController(NSPrivate) _recentDocumentURLsForKey:] + 146 (in AppKit) [0x7fff8bcf1813]
    > 51 -[NSDocumentController _notePendingRecentDocumentURLsForKey:] + 75 (in AppKit) [0x7fff8bce4f94]
    > 51 -[NSDocumentController maximumRecentDocumentCount] + 169 (in AppKit) [0x7fff8bb5935a]
    > 51 _LSGetRecentItemCount + 55 (in LaunchServices) [0x7fff9397a330]
    > 51 LSSharedFileListCopyProperty + 219 (in LaunchServices) [0x7fff9397a4f9]
    > 51 _SFLGetMaxItemCount + 25 (in OSServices) [0x7fff8e83e287]
    > 51 __psynch_mutexwait + 10 (in libsystem_kernel.dylib) [0x7fff8eae6bf2]
    > Kernel stack:
    > 51 lo64_unix_scall + 23 (in mach_kernel) [0x2e4977]
    > 51 unix_syscall64 + 554 (in mach_kernel) [0x5f166a]
    > 51 psynch_mutexwait + 1450 (in mach_kernel) [0x5c4cba]
    > 51 ksyn_block_thread_locked + 77 (in mach_kernel) [0x5beddd]
    > 51 thread_block + 33 (in mach_kernel) [0x22f771]
    > 51 thread_block_reason + 331 (in mach_kernel) [0x22f62b]
    > 51 thread_continue + 1729 (in mach_kernel) [0x22f3a1]
    > 51 machine_switch_context + 582 (in mach_kernel) [0x2cba26]
    >
    > Thread 0x65b57      DispatchQueue 2
    > User stack:
    > 51 _dispatch_mgr_thread + 54 (in libdispatch.dylib) [0x7fff89b9e14e]
    > 51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    > Kernel stack:
    > 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
    >
    > Thread 0x66e05
    > User stack:
    > 51 thread_start + 13 (in libsystem_c.dylib) [0x7fff8b6f0b75]
    > 51 _pthread_start + 335 (in libsystem_c.dylib) [0x7fff8b6ed8bf]
    > 51 __NSThread__main__ + 1575 (in Foundation) [0x7fff8feb06c6]
    > 51 -[NSThread main] + 68 (in Foundation) [0x7fff8feb074e]
    > 51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    > Kernel stack:
    > 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
    >
    > Thread 0x78af7
    > User stack:
    > 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
    > 46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    > Kernel stack:
    > 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
    >
    > Thread 0x78af8
    > User stack:
    > 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
    > 46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    > Kernel stack:
    > 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
  • Graham,

    I have seen similar hangs in other apps while trying to access recent items menu.

    On my Mac I put it down to occasional disk freezing issues quite common on the model of disk I am using, but maybe its software related after all.

    Matt

    On 15 May 2012, at 00:44, Graham Cox wrote:

    > Hi all,
    >
    > A user reported our app "froze" and had to be force quit, and provided this trace from the crash report.
    >
    > It looks to me to be a classic thread deadlock in the bowels of the kernel - can anyone comment? Is there anything we can do about this sort of thing, or just file a bug and hope?
    >
    >
    > --Graham
    >
    > Report (significantly truncated for size)
    >
    >
    > OS Version:      10.7.3 (Build 11D50b)
    > Architecture:    x86_64
    > Report Version:  9
    >
    > Parent:          launchd [150]
    >
    > PID:            1135
    > Event:          hang
    > Duration:        5.24s
    > Steps:          51 (100ms sampling interval)
    >
    >
    > 51 -[NSMenu _populateFromDelegateWithEventRef:] + 213 (in AppKit) [0x7fff8ba8dd7f]
    > 51 -[NSDocumentControllerOpenRecentMenuDelegate updateMenu:withEvent:withFlags:] + 45 (in AppKit) [0x7fff8bb102c3]
    > 51 -[NSDocumentController(NSInternal) _populateOpenRecentMenu:includingIcons:] + 111 (in AppKit) [0x7fff8bced0ab]
    > 51 -[NSDocumentController(NSPrivate) _recentDocumentURLsForKey:] + 146 (in AppKit) [0x7fff8bcf1813]
    > 51 -[NSDocumentController _notePendingRecentDocumentURLsForKey:] + 75 (in AppKit) [0x7fff8bce4f94]
    > 51 -[NSDocumentController maximumRecentDocumentCount] + 169 (in AppKit) [0x7fff8bb5935a]
    > 51 _LSGetRecentItemCount + 55 (in LaunchServices) [0x7fff9397a330]
    > 51 LSSharedFileListCopyProperty + 219 (in LaunchServices) [0x7fff9397a4f9]
    > 51 _SFLGetMaxItemCount + 25 (in OSServices) [0x7fff8e83e287]
    > 51 __psynch_mutexwait + 10 (in libsystem_kernel.dylib) [0x7fff8eae6bf2]
    > Kernel stack:
    > 51 lo64_unix_scall + 23 (in mach_kernel) [0x2e4977]
    > 51 unix_syscall64 + 554 (in mach_kernel) [0x5f166a]
    > 51 psynch_mutexwait + 1450 (in mach_kernel) [0x5c4cba]
    > 51 ksyn_block_thread_locked + 77 (in mach_kernel) [0x5beddd]
    > 51 thread_block + 33 (in mach_kernel) [0x22f771]
    > 51 thread_block_reason + 331 (in mach_kernel) [0x22f62b]
    > 51 thread_continue + 1729 (in mach_kernel) [0x22f3a1]
    > 51 machine_switch_context + 582 (in mach_kernel) [0x2cba26]
    >
    > Thread 0x65b57      DispatchQueue 2
    > User stack:
    > 51 _dispatch_mgr_thread + 54 (in libdispatch.dylib) [0x7fff89b9e14e]
    > 51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    > Kernel stack:
    > 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
    >
    > Thread 0x66e05
    > User stack:
    > 51 thread_start + 13 (in libsystem_c.dylib) [0x7fff8b6f0b75]
    > 51 _pthread_start + 335 (in libsystem_c.dylib) [0x7fff8b6ed8bf]
    > 51 __NSThread__main__ + 1575 (in Foundation) [0x7fff8feb06c6]
    > 51 -[NSThread main] + 68 (in Foundation) [0x7fff8feb074e]
    > 51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
    > Kernel stack:
    > 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
    >
    > Thread 0x78af7
    > User stack:
    > 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
    > 46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    > Kernel stack:
    > 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
    >
    > Thread 0x78af8
    > User stack:
    > 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
    > 46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
    > Kernel stack:
    > 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
  • On 2012 May 16, at 02:23, Matt Gough wrote:

    > Graham,
    >
    > I have seen similar hangs in other apps while trying to access recent items menu.
    >
    > On my Mac I put it down to occasional disk freezing issues quite common on the model of disk I am using, but maybe its software related after all.

    Me too, I think.  When I first read your message yesterday, I seemed to remember that a hang with a lot of Open Recent menu stuff in the call stack had happened to me a couple weeks ago, and I tried to reproduce it.  If it did happen was definitely not able to reproduce it.

    I thought it was maybe because it was running under Xcode 3 in Lion.

    If anyone knows a log directory where such a report might still be I'll go back and look.
previous month may 2012 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today