Search Unity

Unity player freezing then crashing at random times (stacktrace included)

Discussion in 'iOS and tvOS' started by aromana, Feb 16, 2022.

  1. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Hi,

    For the past few weeks, I've noticed users on my app are experiencing an intermittent crash on iOS. The app is built with Unity 2021.2.8f1. Affected users are both iPad and iPhone users, on both iOS 14 and 15.

    In all cases, the app seems to be killed by iOS due to freezing. Some cases due to "exhausted real (wall clock) time allowance of 10.00 seconds", other cases due to "failed to terminate gracefully after 5.0s"

    However, in all cases, the process seems to be waiting for a graphics job to complete. Users report that the app visually freezes until it eventually crashes while this is happening.

    Below is the stack trace that seems to be common to all of these issues. Any guidance/tips on debugging would be greatly appreciated.

    Code (CSharp):
    1.  
    2. Exception Type:  EXC_CRASH (SIGKILL)
    3. Exception Codes: 0x0000000000000000, 0x0000000000000000
    4. Exception Note:  EXC_CORPSE_NOTIFY
    5. Triggered by Thread:  0
    6.  
    7. Thread 0 name:
    8. Thread 0 Crashed:
    9. 0   libsystem_kernel.dylib            0x00000001b8d7c540 semaphore_wait_trap + 8
    10. 1   libdispatch.dylib                 0x000000018142fc00 _dispatch_sema4_wait + 28 (lock.c:139)
    11. 2   libdispatch.dylib                 0x00000001814302b8 _dispatch_semaphore_wait_slow + 132 (semaphore.c:132)
    12. 3   UnityFramework                    0x000000010971ec48 Acquire + 12 (Baselib_SystemSemaphore_DarwinApi.inl.h:36)
    13. 4   UnityFramework                    0x000000010971ec48 Baselib_SystemSemaphore_Acquire + 12 (Baselib_SystemSemaphore_DarwinApi.inl.h:62)
    14. 5   UnityFramework                    0x000000010971ec48 UnityClassic::Baselib_SystemSemaphore_Acquire(UnityClassic::Baselib_SystemSemaphore_Handle) + 28 (Baselib_SystemSemaphore_CProxy.inl.h:19)
    15. 6   UnityFramework                    0x000000010902bef4 Baselib_Semaphore_Acquire + 8 (Baselib_Semaphore_SemaphoreBased.inl.h:47)
    16. 7   UnityFramework                    0x000000010902bef4 WaitForSignal + 8 (Semaphore.h:23)
    17. 8   UnityFramework                    0x000000010902bef4 JobQueue::WaitForJobGroupID(JobGroupID, JobQueue::JobQueueWorkStealMode) + 628 (JobQueue.cpp:1771)
    18. 9   UnityFramework                    0x0000000109480b80 GfxDevice::EndAsyncJobFrame() + 36 (GfxDevice.cpp:807)
    19. 10  UnityFramework                    0x000000010947f7cc GfxDevice::EndGraphicsJobs(GfxDeviceGraphicsJobsSyncPoint) + 64 (GfxDevice.cpp:336)
    20. 11  UnityFramework                    0x0000000109046260 ExecutePlayerLoop(NativePlayerLoopSystem*) + 100 (PlayerLoop.cpp:383)
    21. 12  UnityFramework                    0x00000001090462a0 ExecutePlayerLoop(NativePlayerLoopSystem*) + 164 (PlayerLoop.cpp:404)
    22. 13  UnityFramework                    0x00000001090464f8 PlayerLoop() + 272 (PlayerLoop.cpp:508)
    23. 14  UnityFramework                    0x000000010959f320 UnityPlayerLoopImpl(bool) + 112 (LibEntryPoint.mm:327)
    24. 15  UnityFramework                    0x00000001087d78e8 UnityRepaint + 12 (UnityAppController+Rendering.mm:241)
    25. 16  UnityFramework                    0x00000001087d78e8 -[UnityAppController(Rendering) repaint] + 108 (UnityAppController+Rendering.mm:90)
    26. 17  UnityFramework                    0x00000001087d7850 -[UnityAppController(Rendering) repaintDisplayLink] + 108 (UnityAppController+Rendering.mm:71)
    27. 18  QuartzCore                        0x000000018548bd1c CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 756 (CADisplay.mm:4177)
    28. 19  QuartzCore                        0x0000000185492950 display_timer_callback(__CFMachPort*, void*, long, void*) + 372 (CADisplayTimer.cpp:219)
    29. 20  CoreFoundation                    0x000000018172f440 __CFMachPortPerform + 176 (CFMachPort.c:549)
    30. 21  CoreFoundation                    0x00000001817727d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60 (CFRunLoop.c:1996)
    31. 22  CoreFoundation                    0x0000000181775fe0 __CFRunLoopDoSource1 + 596 (CFRunLoop.c:2136)
    32. 23  CoreFoundation                    0x000000018172febc __CFRunLoopRun + 2380 (CFRunLoop.c:3172)
    33. 24  CoreFoundation                    0x0000000181743468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
    34. 25  GraphicsServices                  0x000000019d2ce38c GSEventRunModal + 164 (GSEvent.c:2200)
    35. 26  UIKitCore                         0x00000001840e5088 -[UIApplication _run] + 1100 (UIApplication.m:3493)
    36. 27  UIKitCore                         0x0000000183e63958 UIApplicationMain + 2092 (UIApplication.m:5046)
    37. 28  UnityFramework                    0x00000001087d7324 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 108 (main.mm:96)
    38. 29  TruffleHogs                       0x0000000102a19ff0 main + 68 (main.mm:26)
    39. 30  dyld                              0x0000000102da5aa4 start + 520 (dyldMain.cpp:879)
    40.  
     
  2. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Bumping this
     
  3. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    Were you able to recreate the issue locally?
    Was there anything common of the crash incidents (like, were the crashes happened on older devices than the newer ones, was it specific to a generation/chipset, etc)?
     
  4. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Thanks for the reply! I haven't been able to reproduce locally. From logs, I can see that the issue seems to affect a wide range of iOS devices, including iOS 14 and 15, so I'm not sure what the case is.

    My rough understanding of reason the iOS kernel killed my app is because it was taking too long doing something. It might not be the case that the stacktrace I posted (which was from the thread that was running when the app was killed) was actually the thread that was taking too much time to run -- it's possible that thread exited already, and it just so happened that the next thread to run was this one. I'm not really sure if that's true, but it seems possible. It would make some more sense that way because the stacktrace doesn't seem to include any of my code in it, only Unity's...
     
  5. tkslan

    tkslan

    Joined:
    Sep 30, 2016
    Posts:
    28
    Bump, same here. It's started at iOS 15.3.1 and now on 15.4 still happens
     
  6. untory1

    untory1

    Joined:
    Apr 14, 2023
    Posts:
    4
    Has your problem been resolved? I also encountered the same random freeze issue here, which also appears on iOS, and the stack is the same.