IOS Crash on App Exit

Hi,

My IOS app crashes on app force quit. ( swipe up ) ( XCode 12.5.1 )

Any help on log would be life saving. I have tried to update unity version to latest Unity 2020 and it didn’t really help.

Date/Time:           2021-11-26 11:00:43.6372 +0000
Launch Time:         2021-11-26 11:00:26.3391 +0000
OS Version:          iPhone OS 15.1 (19B74)
Release Type:        User
Baseband Version:    3.00.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0


Kernel Triage:
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage


Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib            0x00000001b852ef90 __psynch_cvwait + 8
1   libsystem_pthread.dylib           0x00000001f1995254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   UnityFramework                    0x0000000109e65ee4 il2cpp::os::posix::PosixWaitObject::Wait(unsigned int, bool) + 400
3   UnityFramework                    0x0000000109e5ca54 il2cpp::os::Thread::Join() + 24
4   UnityFramework                    0x0000000109e83b5c 0x1086fc000 + 24673116
5   UnityFramework                    0x0000000109e9104c 0x1086fc000 + 24727628
6   UnityFramework                    0x00000001097754c4 CleanupIl2Cpp() + 20
7   UnityFramework                    0x000000010969e004 PlayerCleanup(bool) + 84
8   UnityFramework                    0x0000000109a3ca34 UnityCleanup + 96
9   UnityFramework                    0x000000010870f678 -[UnityAppController applicationWillTerminate:] + 36 (UnityAppController.mm:490)
10  UIKitCore                         0x0000000184a4ae64 -[UIApplication _terminateWithStatus:] + 244 (UIApplication.m:6909)
11  UIKitCore                         0x0000000184135d14 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128 (_UISceneLifecycleMultiplexer.m:808)
12  UIKitCore                         0x000000018432ac5c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 224 (_UISceneLifecycleMultiplexer.m:482)
13  UIKitCore                         0x0000000184a47ae4 -[UIApplication workspaceShouldExit:withTransitionContext:] + 212 (UIApplication.m:3828)
14  FrontBoardServices                0x000000019320ac38 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 80 (FBSWorkspaceScenesClient.m:331)
15  FrontBoardServices                0x00000001931c56b4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 (FBSWorkspace.m:352)
16  FrontBoardServices                0x000000019320abd0 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 132 (FBSWorkspaceScenesClient.m:328)
17  libdispatch.dylib                 0x000000018135f660 _dispatch_client_callout + 20 (object.m:560)
18  libdispatch.dylib                 0x0000000181363118 _dispatch_block_invoke_direct + 264 (queue.c:489)
19  FrontBoardServices                0x00000001931c6f94 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48 (FBSSerialQueue.m:157)
20  FrontBoardServices                0x00000001931c63d4 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220 (FBSSerialQueue.m:181)
21  FrontBoardServices                0x00000001931ca9e4 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:194)
22  CoreFoundation                    0x000000018170f020 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1972)
23  CoreFoundation                    0x000000018171fce0 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016)
24  CoreFoundation                    0x000000018165a054 __CFRunLoopDoSources0 + 376 (CFRunLoop.c:2061)
25  CoreFoundation                    0x000000018165f7f4 __CFRunLoopRun + 820 (CFRunLoop.c:2951)
26  CoreFoundation                    0x00000001816733b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
27  GraphicsServices                  0x000000019d00338c GSEventRunModal + 164 (GSEvent.c:2200)
28  UIKitCore                         0x00000001840136a8 -[UIApplication _run] + 1100 (UIApplication.m:3493)
29  UIKitCore                         0x0000000183d927f4 UIApplicationMain + 2092 (UIApplication.m:5046)
30  UnityFramework                    0x00000001087138e0 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 108 (main.mm:96)
31  MyApp                         0x000000010201bd58 main + 68 (main.mm:26)
32  dyld                              0x0000000102111a24 start + 520 (dyldMain.cpp:876)

7688812–961912–CrashLog.txt (36.7 KB)

I am seeing the same thing. It seems new, so my guess is it’s related to the latest iOS release? I think it’s worth creating an official bug report, but creating a reproducible test case is always a PITA…

I have crashes over a thousand in 15 days!
I’d like to ask apple developer forums but the question is:
Is it a bug in iOS15 or new API that Unity haven’t implemented for iOS15 yet thus causes crashes?

We have the same crash after Apple release iOS15.
Anyone help?

Also having this issue

Does this happen for a new/empty project also? Also, this might help Crashes when you force close an iOS app with another view controller up?

Thanks for the reply. I checked the thread. Seems like that one is a different issue as it’s related to screen orientation.
I’m attaching the crash log below:

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib            0x00000001b7f2df90 __psynch_cvwait + 8
1   libsystem_pthread.dylib           0x00000001f1bfa254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   UnityFramework                    0x000000010a1782a8 0x108c48000 + 22217384
3   UnityFramework                    0x000000010a16e68c il2cpp::os::Thread::Join() + 24
4   UnityFramework                    0x000000010a195f3c 0x108c48000 + 22339388
5   UnityFramework                    0x000000010a1a342c 0x108c48000 + 22393900
6   UnityFramework                    0x0000000109a573e0 0x108c48000 + 14742496
7   UnityFramework                    0x000000010996fa34 PlayerCleanup(bool) + 84
8   UnityFramework                    0x0000000109d3a2a4 UnityCleanup + 16
9   UnityFramework                    0x0000000108c5cc00 -[UnityAppController applicationWillTerminate:] + 36 (UnityAppController.mm:490)
10  OneSignal                         0x0000000105505130 0x1054c8000 + 250160
11  UIKitCore                         0x0000000183bd6104 -[UIApplication _terminateWithStatus:] + 244 (UIApplication.m:6918)
12  UIKitCore                         0x00000001832bd080 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128 (_UISceneLifecycleMultiplexer.m:808)

I think crash happens in internal unity’s internal logic. As seen in the logs, applicationWillTerminate is called by OS and unity called PlayerCleanup method, then it caused stall for more than allowed time (5 seconds)

I believe Apple introduced a watchdog timer in iOS 15 to kill processes lasting longer than 5 seconds after the shutdown request

Yes, indeed!
The question is, why does it take 5+ seconds for Unity to do cleanup.

Not ideal, but my previous post on this would be a path forward, compare to a new/empty project and find the differences.

Thanks for the pointers. I couldn’t reproduce on my devices. It only happens for users who installed the game from AppStore. I’ll try to investigate more. If I can reproduce once on my device, I’ll let you know.

FYI I found a phone that has this crash issue. I’ll try to test and see if I can reproduce it. Fingers crossed

Hey did you find a solution?

Yeah upgraded latest unity version. Now the issue is gone.

Hi! Can you tell which version it is? And in which version of unity issue reproduces?

I’m using 2022 LTS at the moment without any issues

Is ti really because of app version, I am on 23.1.15f1.

I’m sure it’s because of the update, now we need to wait for fixes.