Forum Xamarin.Mac

Application freeze ux_exception

ovi_ovi_ Member

Hello everyone!

Sometimes our users catch strange freezes with next spindump logs

  Thread 0x1451    DispatchQueue "com.apple.main-thread"(1)    Thread name "CrBrowserMain"    1000 samples (1-1000)    priority 46 (base 46)
  1000  start + 1 (libdyld.dylib + 108541) [0x7fff6c7347fd]
    1000  main + 36 (Workplace + 236404) [0x10ae23b74]
      1000  xamarin_main + 1167 (Workplace + 232639) [0x10ae22cbf]
        1000  mono_main + 11731 (Workplace + 520323) [0x10ae69083]
          1000  mono_jit_exec + 311 (Workplace + 507383) [0x10ae65df7]
            1000  mono_runtime_exec_main_checked + 109 (Workplace + 2418493) [0x10b03873d]
              1000  mono_runtime_invoke_checked + 136 (Workplace + 2389352) [0x10b031568]
                1000  mono_jit_runtime_invoke + 1585 (Workplace + 1179873) [0x10af0a0e1]
                  1000  ??? [0x10b62c099]
                    1000  ??? [0x12717ec65]
                      1000  ??? (Chromium Embedded Framework + 37109744) [0x10f41aff0]
                        1000  ??? (Chromium Embedded Framework + 39912605) [0x10f6c749d]
                          1000  ??? (Chromium Embedded Framework + 40085638) [0x10f6f1886]
                            1000  ??? (Chromium Embedded Framework + 39778952) [0x10f6a6a88]
                              1000  ??? (Chromium Embedded Framework + 39784284) [0x10f6a7f5c]
                                1000  -[NSApplication run] + 658 (AppKit + 200862) [0x7fff3224509e]
                                  1000  -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352 (AppKit + 258944) [0x7fff32253380]
                                    1000  _DPSNextEvent + 990 (AppKit + 265124) [0x7fff32254ba4]
                                      1000  _BlockUntilNextEventMatchingListInModeWithFilter + 64 (HIToolbox + 192807) [0x7fff33be4127]
                                        1000  ReceiveNextEventCommon + 600 (HIToolbox + 193437) [0x7fff33be439d]
                                          1000  RunCurrentEventLoopInMode + 292 (HIToolbox + 194141) [0x7fff33be465d]
                                            1000  CFRunLoopRunSpecific + 499 (CoreFoundation + 535507) [0x7fff3508ebd3]
                                              1000  __CFRunLoopRun + 2792 (CoreFoundation + 539952) [0x7fff3508fd30]
                                                1000  __CFRunLoopDoBlocks + 379 (CoreFoundation + 542445) [0x7fff350906ed]
                                                  1000  __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 (CoreFoundation + 542635) [0x7fff350907ab]
                                                    1000  ___LSScheduleNotificationFunction_block_invoke_2 + 47 (LaunchServices + 199420) [0x7fff367ecafc]
                                                      1000  applicationStatusSubsystemCallback + 736 (AppKit + 2602986) [0x7fff3248f7ea]
                                                        1000  -[NSNotificationCenter postNotificationName:object:userInfo:] + 59 (Foundation + 39458) [0x7fff376daa22]
                                                          1000  _CFXNotificationPost + 1351 (CoreFoundation + 298114) [0x7fff35054c82]
                                                            1000  -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1575 (CoreFoundation + 301026) [0x7fff350557e2]
                                                              1000  ___CFXNotificationPost_block_invoke + 97 (CoreFoundation + 499390) [0x7fff35085ebe]
                                                                1000  _CFXRegistrationPost1 + 372 (CoreFoundation + 500328) [0x7fff35086268]
                                                                  1000  ___CFXRegistrationPost1_block_invoke + 63 (CoreFoundation + 500467) [0x7fff350862f3]
                                                                    1000  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 (CoreFoundation + 500575) [0x7fff3508635f]
                                                                      1000  xamarin_x86_64_common_trampoline + 110 (Workplace + 231281) [0x10ae22771]
                                                                        1000  xamarin_arch_trampoline + 181 (Workplace + 226165) [0x10ae21375]
                                                                          1000  xamarin_invoke_trampoline + 471 (Workplace + 217223) [0x10ae1f087]
                                                                            1000  -[NSObject(NSObject) methodSignatureForSelector:] + 38 (CoreFoundation + 624032) [0x7fff350a45a0]
                                                                              1000  __methodDescriptionForSelector + 74 (CoreFoundation + 509702) [0x7fff35088706]
                                                                                1000  class_copyProtocolList + 69 (libobjc.A.dylib + 60828) [0x7fff6b3c2d9c]
                                                                                  1000  __ulock_wait + 10 (libsystem_kernel.dylib + 10686) [0x7fff6c8769be]
                                                                                   *1000  ??? (kernel + 7083008) [0xffffff80008c1400] (blocked by turnstile waiting for Workplace [793] thread 0xd0d7)
...
...
...
Thread 0xd0d7    Thread name "Thread Pool Worker"    1000 samples (1-1000)    priority 2-46 (base 46)    cpu time 9.510s (19.9G cycles, 14.5G instructions, 1.37c/i)
  1000  thread_start + 15 (libsystem_pthread.dylib + 6203) [0x7fff6c93483b]
    1000  _pthread_start + 148 (libsystem_pthread.dylib + 24165) [0x7fff6c938e65]
      1000  start_wrapper + 71 (Workplace + 2752647) [0x10b08a087]
        1000  start_wrapper_internal + 688 (Workplace + 2753376) [0x10b08a360]
          1000  mono_thread_detach_internal + 1291 (Workplace + 2722779) [0x10b082bdb]
            1000  mono_profiler_raise_thread_stopped + 53 (Workplace + 2473573) [0x10b045e65]
              1000  thread_end(_MonoProfiler*, unsigned long) + 28 (Workplace + 176028) [0x10ae14f9c]
                1000  xamarin_thread_finish(void*) + 144 (Workplace + 176624) [0x10ae151f0]
                  1000  -[NSAutoreleasePool drain] + 137 (Foundation + 212769) [0x7fff37704f21]
                    1000  _CFAutoreleasePoolPop + 22 (CoreFoundation + 270005) [0x7fff3504deb5]
                      1000  objc_autoreleasePoolPop + 175 (libobjc.A.dylib + 33792) [0x7fff6b3bc400]
                        1000  AutoreleasePoolPage::releaseUntil(objc_object**) + 134 (libobjc.A.dylib + 140474) [0x7fff6b3d64ba]
                          1000  _objc_msgSend_uncached + 73 (libobjc.A.dylib + 27545) [0x7fff6b3bab99]
                            1000  lookUpImpOrForward + 677 (libobjc.A.dylib + 29367) [0x7fff6b3bb2b7]
                              673  dataSegmentsContain(objc_class*) + 59 (libobjc.A.dylib + 96119) [0x7fff6b3cb777]
                               *419  hndl_alltraps + 223 (kernel + 928079) [0xffffff80002e294f]
                                 *337  user_trap + 684 (kernel + 2512460) [0xffffff800046564c]
                                   *326  exception_triage_thread + 417 (kernel + 1300577) [0xffffff800033d861]
                                     *266  exception_deliver + 1295 (kernel + 1299951) [0xffffff800033d5ef]
                                       *257  mach_exception_raise + 269 (kernel + 1692509) [0xffffff800039d35d]
                                         *169  mach_msg_rpc_from_kernel_body + 268 (kernel + 1320924) [0xffffff80003427dc]
                                           *120  ipc_kmsg_send + 309 (kernel + 1148469) [0xffffff8000318635]
                                             *72   ipc_kobject_server + 568 (kernel + 1317336) [0xffffff80003419d8]
                                               *69   ??? (kernel + 1694090) [0xffffff800039d98a]
                                                 *39   catch_mach_exception_raise + 103 (kernel + 1614983) [0xffffff800038a487]
                                                   *16   handle_ux_exception + 379 (kernel + 7495659) [0xffffff8000925feb]
                                                     *8    ??? (kernel + 1557271) [0xffffff800037c317] (running)
                                                     *1    threadsignal + 118 (kernel + 6925094) [0xffffff800089ab26] (running)
                                                     *1    threadsignal + 12 (kernel + 6924988) [0xffffff800089aabc] (running)
                                                     *1    IOLockUnlock + 82 (kernel + 2481618) [0xffffff800045ddd2] (running)
                                                     *1    IOLockUnlock + 45 (kernel + 2481581) [0xffffff800045ddad] (running)
                                                     *1    IOLockUnlock + 34 (kernel + 2481570) [0xffffff800045dda2] (running)
                                                     *1    IOLockUnlock + 0 (kernel + 2481536) [0xffffff800045dd80] (running)
                                                     *1    IOLockLock + 33 (kernel + 2480897) [0xffffff800045db01] (running)
                                                     *1    IOLockLock + 6 (kernel + 2480870) [0xffffff800045dae6] (running)
                                                   *11   handle_ux_exception + 387 (kernel + 7495667) [0xffffff8000925ff3]
                                                     *3    IOLockUnlock + 45 (kernel + 2481581) [0xffffff800045ddad] (running)
                                                     *3    IOLockLock + 33 (kernel + 2480897) [0xffffff800045db01] (running)
                                                     *1    IOLockUnlock + 82 (kernel + 2481618) [0xffffff800045ddd2] (running)
                                                     *1    IOLockUnlock + 34 (kernel + 2481570) [0xffffff800045dda2] (running)
                                                     *1    IOLockUnlock + 14 (kernel + 2481550) [0xffffff800045dd8e] (running)
                                                     *1    IOLockUnlock + 0 (kernel + 2481536) [0xffffff800045dd80] (running)
                                                     *1    IOLockLock + 155 (kernel + 2481019) [0xffffff800045db7b]
                                                       *1    ??? (kernel + 928320) [0xffffff80002e2a40]
                                                         *1    kernel_trap + 705 (kernel + 2510113) [0xffffff8000464d21]
                                                           *1    thread_block_reason + 175 (kernel + 1425263) [0xffffff800035bf6f]
                                                             *1    ??? (kernel + 1431409) [0xffffff800035d771]
                                                               *1    machine_switch_context + 200 (kernel + 2490744) [0xffffff8000460178] (runnable)
                                                   *11   handle_ux_exception + 31 (kernel + 7495311) [0xffffff8000925e8f]
                                                     *3    IOLockLock + 6 (kernel + 2480870) [0xffffff800045dae6] (running)
                                                     *2    proc_findthread + 21 (kernel + 6864517) [0xffffff800088be85]
                                                       *2    ??? (kernel + 2477019) [0xffffff800045cbdb]
                                                         *2    lck_mtx_lock_wait_x86 + 313 (kernel + 2478777) [0xffffff800045d2b9]
                                                           *2    thread_block_reason + 175 (kernel + 1425263) [0xffffff800035bf6f]
                                                             *2    ??? (kernel + 1431409) [0xffffff800035d771]
                                                               *2    machine_switch_context + 200 (kernel + 2490744) [0xffffff8000460178] (runnable)
                                                     *2    IOLockUnlock + 45 (kernel + 2481581) [0xffffff800045ddad] (running)
                                                     *1    proc_findthread + 79 (kernel + 6864575) [0xffffff800088bebf]
                                                       *1    proc_ref_locked + 30 (kernel + 6863694) [0xffffff800088bb4e] (running)
                                                     *1    proc_findthread + 40 (kernel + 6864536) [0xffffff800088be98] (running)
                                                     *1    IOLockLock + 33 (kernel + 2480897) [0xffffff800045db01] (running)
                                                     *1    return_to_iret + 276 (kernel + 929028) [0xffffff80002e2d04]
                                                       *1    thread_block_reason + 175 (kernel + 1425263) [0xffffff800035bf6f]
                                                         *1    ??? (kernel + 1431409) [0xffffff800035d771]
                                                           *1    machine_switch_context + 200 (kernel + 2490744) [0xffffff8000460178] (runnable)
                                                   *1    handle_ux_exception + 77 (kernel + 7495357) [0xffffff8000925ebd] (running)
                                                 *8    catch_mach_exception_raise + 72 (kernel + 1614952) [0xffffff800038a468]
                                                   *4    convert_port_to_task + 164 (kernel + 1335828) [0xffffff8000346214] (running)
                                                   *4    convert_port_to_task + 75 (kernel + 1335739) [0xffffff80003461bb]
                                                     *3    usimple_lock + 53 (kernel + 2466789) [0xffffff800045a3e5]
                                                       *2    hw_lock_to + 48 (kernel + 1360880) [0xffffff800034c3f0] (running)
                                                       *1    return_to_iret + 276 (kernel + 929028) [0xffffff80002e2d04]
                                                         *1    thread_block_reason + 175 (kernel + 1425263) [0xffffff800035bf6f]
                                                           *1    ??? (kernel + 1431409) [0xffffff800035d771]
                                                             *1    machine_switch_context + 200 (kernel + 2490744) [0xffffff8000460178] (runnable)
                                                     *1    usimple_lock + 24 (kernel + 2466760) [0xffffff800045a3c8] (running)
                                                 *8    catch_mach_exception_raise + 55 (kernel + 1614935) [0xffffff800038a457]
                                                   *3    convert_port_to_thread + 75 (kernel + 1336747) [0xffffff80003465ab]
                                                     *3    usimple_lock + 53 (kernel + 2466789) [0xffffff800045a3e5]
                                                       *1    hw_lock_to + 90 (kernel + 1360922) [0xffffff800034c41a] (running)
                                                       *1    hw_lock_to + 75 (kernel + 1360907) [0xffffff800034c40b] (running)
                                                       *1    hw_lock_to + 48 (kernel + 1360880) [0xffffff800034c3f0] (running)
                                                   *2    convert_port_to_thread + 171 (kernel + 1336843) [0xffffff800034660b] (running)
                                                   *1    zone_require + 28 (kernel + 1639548) [0xffffff800039047c] (running)
                                                   *1    hw_lock_unlock + 0 (kernel + 1361200) [0xffffff800034c530] (running)
                                                   *1    convert_port_to_thread + 8 (kernel + 1336680) [0xffffff8000346568] (running)
                                                 *7    catch_mach_exception_raise + 141 (kernel + 1615021) [0xffffff800038a4ad]
                                                   *3    ipc_port_release_send + 86 (kernel + 1191094) [0xffffff8000322cb6]
                                                     *1    usimple_lock + 48 (kernel + 2466784) [0xffffff800045a3e0] (running)
                                                     *1    usimple_lock + 4 (kernel + 2466740) [0xffffff800045a3b4] (running)
                                                     *1    return_to_iret + 276 (kernel + 929028) [0xffffff80002e2d04]
                                                       *1    thread_block_reason + 175 (kernel + 1425263) [0xffffff800035bf6f]
                                                         *1    ??? (kernel + 1431409) [0xffffff800035d771]
                                                           *1    machine_switch_context + 200 (kernel + 2490744) [0xffffff8000460178] (runnable)
.......

Can anyone help me to analyze logs? Maybe someone could point me a direction to look on?
I'm more interested in stacktrace of last thread (Full logs in atachments). AOT is enabled.

Thanks in advance!

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Very interesting log. I took a look at it with another colleague and here's what we can see:

    • The main thread is roughtly: Mono's main, Call Chrome, Chrome runs main, NSNotifcation post, Call some managed object, get lock, hang
    • Thread 0xd0d7 is unclear, then we try to drain an autorelease pool and throw an exception, someone tries to catch and a bunch of confusion.

    Things that are unclear:

    • Did Xamarin put the item in the autorelease pool that when drained throw, or did Chrome?
    • Did the thread clearly close and autorelease kill us, or was there something that caused the thread to rip down and corrupt state such that the dispose hung.

    In any case, native ObjC exceptions are brutal, and have been known to corrupt state in Cocoa before. The fact that it's causing a hang is not shocking.

    Having all of Chrome in process makes things difficult to pin down, this very well could be a landmine Chrome set that we're just triggering since we're draining the pool.

    I know everything I just said was less that helpful. A few things you could try:

    • Try to get exception information/logs from the users if are you capturing them, to see if you can get an idea what native exception is triggering this cascade.
    • See what background threads are going on. With chrome in process, that might be very difficult.
    • Try to isolate a subset of your app that reproduces it.

    If you can pin this down to a small self-contained sample that you can file an xamairn-macios issue against, specially without Chrome in process, we'd be happy to look at that bug.

Sign In or Register to comment.