Strange Crash on Shutdown?

This one is a weird one we’d like some help with.

So at Embrace we work on an observability plugin, and for some of our customers, upon integrating we’re seeing an increase in crashes on Android. Digging into the stack traces that we’ve collected, we’re seeing some pretty weird stuff.
The customer’s app is in 2021.3.34f1.

The stack traces of interest seem to involve calls to UnityFinalDeInitApplication(), which originates from a call to com.unity3d.player.UnityPlayer.shutdown. Further downstream we get calls to a number of C++ class deconstructors and freeing of memory. Additionally, in the reference stack trace below, generally any variation occurs in frames 0-6.

Notably, we’ve seen crashes from hundreds of devices and there does not seem to be any specific device or manufacturer that is having a higher rate of crashes than expected. Similarly there does not seem to be any correlation to Android version.

We have noticed that there is a log, typically a few seconds before the crash, that is emitted when the Application.quitting event fires. We’ve seen this in all crash instances we’ve looked at, but we also see this in sessions that do not crash.

Mostly we just need guidance. What are the conditions under which UnityFinalDeInitApplication() gets called? Is this only called when the user force-exits the application or are there other scenarios where this could occur? Are there any known issues with UnityFinalDeInitApplication()? What could we be doing that would ultimately cause freeing of memory and resource to crash? Do y’all have any thoughts on what we could be doing to influence and/or cause this issue?

stack-trace

0 /apex/com.android.runtime/lib64/bionic/libc.so(0134f84c20fbcd07ebc028180281f8e3):madvise +8
1 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):UnityClassic::Baselib_Memory_SetPageState(void*, unsigned long, unsigned long, UnityClassic::Baselib_Memory_PageState, UnityClassic::Baselib_ErrorState*) +576
2 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):MemoryManager::VirtualAllocator::smile:ecommitMemory(void*, unsigned long) +204
3 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):ThreadsafeLinearAllocator<false>::~ThreadsafeLinearAllocator() +96
4 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):MemoryManager::ThreadCleanup() +164
5 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):MemoryManager::~MemoryManager() +12
6 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):MemoryManager::StaticDestroy() +12
7 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):RuntimeCleanup() +160
8 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):UnityFinalDeinitApplication() +20
9 /data/app/NNNNNN/lib/arm64/libunity.so(b551fa4b6387a1f5e81fff5829cb7f3bb2b51800):nativeDone(_JNIEnv*, _jobject*) +120
10 /data/app/NNNNNN/oat/arm64/base.odex(<no ID>):art_jni_trampoline +116
11 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):nterp_helper +4016
12 /data/app/NNNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.shutdown
13 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):nterp_helper +3924
14 /data/app/NNNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.access$2000
15 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):nterp_helper +52
16 /data/app/NNNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer$26.run +4
17 /system/framework/arm64/boot-framework.oat(8337f7fa309f1181abb11b0b03c1a093d63ce1b9):android.os.Handler.dispatchMessage +84
18 /system/framework/arm64/boot-framework.oat(8337f7fa309f1181abb11b0b03c1a093d63ce1b9):android.os.Looper.loopOnce +1032
19 /system/framework/arm64/boot-framework.oat(8337f7fa309f1181abb11b0b03c1a093d63ce1b9):android.os.Looper.loop +560
20 /data/app/NNNNNN/oat/arm64/base.odex(<no ID>):com.unity3d.player.UnityPlayer$e.run +492
21 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):art_quick_invoke_stub +556
22 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) +156
23 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*) +400
24 /apex/com.android.art/lib64/libart.so(6fc1c03912861b04885c9f2953121b6b):art::Thread::CreateCallback(void*) +1680
25 /apex/com.android.runtime/lib64/bionic/libc.so(0134f84c20fbcd07ebc028180281f8e3):__pthread_start(void*) +204
26 /apex/com.android.runtime/lib64/bionic/libc.so(0134f84c20fbcd07ebc028180281f8e3):__start_thread +64

stack-trace-v1

00: /apex/com.android.runtime/lib64/bionic/libc.so(544bc6c8e3556e98efbc4406b97f6a3e):madvise +12
01: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):UnityClassic::Baselib_Memory_SetPageState(void*, unsigned long, unsigned long, UnityClassic::Baselib_Memory_PageState, UnityClassic::Baselib_ErrorState*) +576
02: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::VirtualAllocator::smile:ecommitMemory(void*, unsigned long) +204
03: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:ynamicHeapAllocator::RemoveBlock(void*) +244
04: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:ynamicHeapAllocator::TryRemoveBlock(void*) +60
05: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:ynamicHeapAllocator::smile:eallocate(void*) +368
06: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:elayedPointerDeletionManager::CleanupPendingMainThreadPointersInternal() +48
07: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:elayedPointerDeletionManager::smile:eallocateLocalMemory() +44
08: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:ualThreadAllocator<DynamicHeapAllocator>::ThreadCleanup() +28
09: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):smile:ualThreadAllocator<DynamicHeapAllocator>::FrameMaintenance(bool) +44
10: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::FrameMaintenance(bool) +88
11: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):RuntimeCleanup() +152
12: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):UnityFinalDeinitApplication() +20
13: /data/app/NNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):nativeDone(_JNIEnv*, _jobject*) +120
14: /data/app/NNNN/oat/arm64/base.odex(<no ID>):art_jni_trampoline +116
15: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +4016
16: /data/app/NNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.shutdown
17: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +3924
18: /data/app/NNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.access$2000
19: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +52
20: /data/app/NNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer$26.run +4
21: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Handler.dispatchMessage +76
22: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loopOnce +1036
23: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loop +1112
24: /data/app/NNNN/oat/arm64/base.odex(<no ID>):com.unity3d.player.UnityPlayer$e.run +596
25: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art_quick_invoke_stub +612
26: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) +144
27: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art::Thread::CreateCallback(void*) +1600
28: /apex/com.android.runtime/lib64/bionic/libc.so(544bc6c8e3556e98efbc4406b97f6a3e):__pthread_start(void*) +208
29: /apex/com.android.runtime/lib64/bionic/libc.so(544bc6c8e3556e98efbc4406b97f6a3e):__start_thread +68

stack-trace-v2

00: /apex/com.android.runtime/lib64/bionic/libc.so(3908c7c57fa04c64df24425cf16523cf):madvise +8
01: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):UnityClassic::Baselib_Memory_SetPageState(void*, unsigned long, unsigned long, UnityClassic::Baselib_Memory_PageState, UnityClassic::Baselib_ErrorState*) +576
02: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::VirtualAllocator::smile:ecommitMemory(void*, unsigned long) +204
03: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):TLSAllocator<(AllocatorMode)0>::~TLSAllocator() +92
04: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::ThreadCleanup() +164
05: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::~MemoryManager() +12
06: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):MemoryManager::StaticDestroy() +12
07: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):RuntimeCleanup() +160
08: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):UnityFinalDeinitApplication() +20
09: /data/app/NNNNN/lib/arm64/libunity.so(e38088f193166de2e4c4a3c897172e2c73e3465e):nativeDone(_JNIEnv*, _jobject*) +120
10: /data/app/NNNNN/oat/arm64/base.odex(<no ID>):art_jni_trampoline +116
11: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +4016
12: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.shutdown
13: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +3924
14: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.access$2000
15: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):nterp_helper +52
16: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer$26.run +4
17: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Handler.dispatchMessage +76
18: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loopOnce +1048
19: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loop +1132
20: /data/app/NNNNN/oat/arm64/base.odex(<no ID>):com.unity3d.player.UnityPlayer$e.run +440
21: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art_quick_invoke_stub +612
22: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) +144
23: /apex/com.android.art/lib64/libart.so(02bec5940be704b863f6514fc7d81c41):art::Thread::CreateCallback(void*) +1600
24: /apex/com.android.runtime/lib64/bionic/libc.so(3908c7c57fa04c64df24425cf16523cf):__pthread_start(void*) +204
25: /apex/com.android.runtime/lib64/bionic/libc.so(3908c7c57fa04c64df24425cf16523cf):__start_thread +64

stack-trace-v3

00: /apex/com.android.runtime/lib64/bionic/libc.so(ae97b4676db8ce3f620ba6bf7932eba6):madvise +8
01: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):UnityClassic::Baselib_Memory_SetPageState(void*, unsigned long, unsigned long, UnityClassic::Baselib_Memory_PageState, UnityClassic::Baselib_ErrorState*) +576
02: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):MemoryManager::VirtualAllocator::smile:ecommitMemory(void*, unsigned long) +204
03: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):smile:ynamicHeapAllocator::RemoveBlock(void*) +244
04: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):smile:ynamicHeapAllocator::TryRemoveBlock(void*) +60
05: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):smile:ynamicHeapAllocator::smile:eallocate(void*) +368
06: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):smile:ualThreadAllocator<DynamicHeapAllocator>::TryDeallocate(void*) +224
07: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):MemoryManager::smile:eallocate(void*, MemLabelId, char const*, int) +148
08: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__hash_table<std::__ndk1::__hash_value_type<unsigned int, unwindstack::smile:warfLocation>, std::__ndk1::__unordered_map_hasher<unsigned int, std::__ndk1::__hash_value_type<unsigned int, unwindstack::smile:warfLocation>, std::__ndk1::hash<unsigned int>, true>, std::__ndk1::__unordered_map_equal<unsigned int, std::__ndk1::__hash_value_type<unsigned int, unwindstack::smile:warfLocation>, std::__ndk1::equal_to<unsigned int>, true>, std::__ndk1::allocator<std::__ndk1::__hash_value_type<unsigned int, unwindstack::smile:warfLocation> > >::~__hash_table() +24
09: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +44
10: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +24
11: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +24
12: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +36
13: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +24
14: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +36
15: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::__tree<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::__map_value_compare<unsigned long, std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, std::__ndk1::less<unsigned long>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations> > >::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<unsigned long, unwindstack::smile:warfLocations>, void*>*) +24
16: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::smile:warfSection::~DwarfSection() +24
17: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::smile:warfEhFrameWithHdr<unsigned long>::~DwarfEhFrameWithHdr() +32
18: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::ElfInterface::~ElfInterface() +144
19: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::ElfInterface64::~ElfInterface64() +8
20: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::Elf::~Elf() +8
21: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::shared_ptr<unwindstack::Elf>::~shared_ptr() +56
22: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::MapInfo::~MapInfo() +60
23: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):std::__ndk1::unique_ptr<unwindstack::MapInfo, std::__ndk1::default_delete<unwindstack::MapInfo> >::reset(unwindstack::MapInfo*) +20
24: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):unwindstack::LocalUpdatableMaps::Clear() +80
25: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):UnityFinalDeinitApplication() +16
26: /data/app/NNNNN/lib/arm64/libunity.so(8244b1c5087ba2be547207f4b1f1bfa716327c2f):nativeDone(_JNIEnv*, _jobject*) +120
27: /data/app/NNNNN/oat/arm64/base.odex(<no ID>):art_jni_trampoline +116
28: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):nterp_helper +4016
29: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.shutdown
30: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):nterp_helper +3924
31: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer.access$2000
32: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):nterp_helper +52
33: /data/app/NNNNN/oat/arm64/base.vdex(<no ID>):com.unity3d.player.UnityPlayer$26.run +4
34: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Handler.dispatchMessage +76
35: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loopOnce +1000
36: /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat(<no ID>):android.os.Looper.loop +1112
37: /data/app/NNNNN/oat/arm64/base.odex(<no ID>):com.unity3d.player.UnityPlayer$e.run +596
38: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):art_quick_invoke_stub +612
39: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) +144
40: /apex/com.android.art/lib64/libart.so(735f12f804f88d62a2cb437261076ff7):art::Thread::CreateCallback(void*) +1600
41: /apex/com.android.runtime/lib64/bionic/libc.so(ae97b4676db8ce3f620ba6bf7932eba6):__pthread_start(void*) +208
42: /apex/com.android.runtime/lib64/bionic/libc.so(ae97b4676db8ce3f620ba6bf7932eba6):__start_thread +64

Hello, I’m not entirely sure what is causing your crash, but to answer the question around UnityFinalDeInitApplication().

UnityFinalDeInitApplication() is typically called during the shutdown procedure of a Unity application. It is a part of the cleaning process to ensure all resources are deallocated properly and any cleanup tasks that need to be performed before the application is terminated are executed.

Common conditions that could cause this function to be called include:

  • The user purposefully closes the application: This could include closing the window in a desktop application, or fully exiting out of a mobile app.
  • The system forcefully closes the application: This could be due to the operating system shutting down, or the application being killed due to a system resource constraint.
  • The application encounters a critical error or exception: In some cases, a severe enough error may cause the application to begin shutdown procedures, which includes calling this function.
  • The developer manually triggers a application shutdown: The developer has the ability to programmatically initiate application shutdown, which would lead to this function being called.

It’s important to note that not every application exit may call this function, such as in the case of a crash or immediate termination.

For the callstack resolving in Android, are you using the logcat stacktrace utility to help resolve symbol paths?
https://docs.unity3d.com/Packages/com.unity.mobile.android-logcat@1.4/manual/stacktrace-utility-set-up.html

For the callstack resolving in Android, are you using the logcat stacktrace utility to help resolve symbol paths?

Thanks for the quick response!

We have our own pipeline for symbolication, but I have spot-checked our symbolication results with what we see in Google Play Console and they align, so I’m pretty confident that the symbolication is correct.

Are there any guidelines about things we should not be doing once the Application.quitting event has been observed and UnityFinalDeInitApplication() has been called? Our current best guess is that some parts of what the Unity engine expects to remain unchanged during the shutdown process are changing.

I’ve encountered the same issue When I upgraded from Unity 2021.3.15 to 2021.3.34.If there’s a solution, please reply here. Thanks.

Solution is to use another editor or completely different engine. Unity has more bugs than the amazon rainforest, unfortunately. My editor has started doing this today and the stack trace shows literally nothing other than “shut down”. No reference why. I give up using Unity.