Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on application exit ios (Messaging and Analytics sdks) #271

Closed
gilgil28 opened this issue Dec 12, 2018 · 19 comments
Closed

Crashes on application exit ios (Messaging and Analytics sdks) #271

gilgil28 opened this issue Dec 12, 2018 · 19 comments

Comments

@gilgil28
Copy link

gilgil28 commented Dec 12, 2018

I have both packages in my project using unity 2018.2.6f1. After the initialization (CheckAndFixDependenciesAsync part) everything is working fine except when I close the app, I get a crash on xcode:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x1267ddc48)

Here is the code that xcode is pointing at:
public:
//internal
static FORCE_INLINE const VirtualInvokeData& GetInterfaceInvokeDataFromVTable(const Il2CppObject* obj, const Il2CppClass* itf, Il2CppMethodSlot slot)
{
const Il2CppClass* klass = obj->klass;
IL2CPP_ASSERT(klass->initialized);
IL2CPP_ASSERT(slot < itf->method_count);

       for (uint16_t i = 0; i < klass->interface_offsets_count; i++)
       {
           if (klass->interfaceOffsets[i].interfaceType == itf)
           {
               int32_t offset = klass->interfaceOffsets[i].offset;
               IL2CPP_ASSERT(offset != -1);
               IL2CPP_ASSERT(offset + slot < klass->vtable_count);
               return klass->vtable[offset + slot];
           }
       }

       return GetInterfaceInvokeDataFromVTableSlowPath(obj, itf, slot);
   }

specifically on this line:
if (klass->interfaceOffsets[i].interfaceType == itf)

I tried latest 5.4.3 version and tried going back to 5.4.2 without any luck

@gilgil28 gilgil28 changed the title crashes on application exit ios (Messaging and Analytics sdks) Crashes on application exit ios (Messaging and Analytics sdks) Dec 12, 2018
@buihuuloc
Copy link

Hi there,
I got the same problem here.

@chkuang-g
Copy link
Contributor

Hi all,

Could you provide the callstack if available?

Thank you!
Shawn

@buihuuloc
Copy link

buihuuloc commented Dec 13, 2018

Hi @chkuang-g
Here is full stacktrace

Libraries/libil2cpp/include/vm/Class.h:107:13InterfaceFuncInvoker0<int>::Invoke(unsigned int, Il2CppClass*, Il2CppObject*)	
Classes/Native/Bulk_Firebase.Platform_0.cpp:10430:17FirebaseLogger_LogMessage_m2677119794	
Classes/Native/Bulk_Firebase.Platform_0.cpp:10430:17FirebaseLogger_LogMessage_m2677119794	
arfirebase::AppLogCallback(firebase::LogLevel, char const*, void*)	
arfirebase::LogMessageWithCallbackV(firebase::LogLevel, char const*, char*)	
arfirebase::LogWarning(char const*, ...)	
arfirebase::CppInstanceManager<firebase::App>::~CppInstanceManager()	
/usr/lib/system/libsystem_c.dylib___cxa_finalize_ranges	
/usr/lib/system/libsystem_c.dylib_exit	
PrivateFrameworks/UIKitCore.framework/UIKitCore-[UIApplication _terminateWithStatus:]	
PrivateFrameworks/UIKitCore.framework/UIKitCore___98-[__UICanvasLifecycleMonitor_Compatability deactivateEventsOnly:withContext:forceExit:completion:]_block_invoke.279	
PrivateFrameworks/UIKitCore.framework/UIKitCore__runAfterCACommitDeferredBlocks	
PrivateFrameworks/UIKitCore.framework/UIKitCore__cleanUpAfterCAFlushAndRunDeferredBlocks	
PrivateFrameworks/UIKitCore.framework/UIKitCore__afterCACommitHandler	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopDoObservers	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopRun	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRunSpecific	
PrivateFrameworks/GraphicsServices.framework/GraphicsServices_GSEventRunModal	
PrivateFrameworks/UIKitCore.framework/UIKitCore_UIApplicationMain	
Classes/main.mm:33:9main	
/usr/lib/system/libdyld.dylib_start	
Thread 1·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread	
Thread 2·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread	
Thread 3·
/usr/lib/system/libsystem_kernel.dylib_mach_msg_trap	
/usr/lib/system/libsystem_kernel.dylib_mach_msg	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopServiceMachPort	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopRun	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRunSpecific	
Frameworks/Foundation.framework/Foundation-[NSRunLoop(NSRunLoop) runMode:beforeDate:]	
Frameworks/Foundation.framework/Foundation-[NSRunLoop(NSRunLoop) runUntilDate:]	
PrivateFrameworks/UIKitCore.framework/UIKitCore-[UIEventFetcher threadMain]	
Frameworks/Foundation.framework/Foundation___NSThread__start__	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 4·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread	
Thread 5·
/usr/lib/system/libsystem_kernel.dylib_mach_msg_trap	
/usr/lib/system/libsystem_kernel.dylib_mach_msg	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopServiceMachPort	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopRun	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRunSpecific	
Frameworks/AVFoundation.framework/Frameworks/AVFAudio.framework/AVFAudioGenericRunLoopThread::Entry(void*)	
Frameworks/AVFoundation.framework/Frameworks/AVFAudio.framework/AVFAudioCAPThread::Entry(CAPThread*)	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 6·
/usr/lib/system/libsystem_kernel.dylib_mach_msg_trap	
/usr/lib/system/libsystem_kernel.dylib_mach_msg	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopServiceMachPort	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopRun	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRunSpecific	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRun	
Frameworks/CoreMotion.framework/CoreMotion0x1868ab364 (-0x2fbcc000 + 7353103204)	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 7·
/usr/lib/system/libsystem_kernel.dylib_mach_msg_trap	
/usr/lib/system/libsystem_kernel.dylib_mach_msg	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopServiceMachPort	
Frameworks/CoreFoundation.framework/CoreFoundation___CFRunLoopRun	
Frameworks/CoreFoundation.framework/CoreFoundation_CFRunLoopRunSpecific	
Frameworks/CFNetwork.framework/CFNetwork-[__CoreSchedulingSetRunnable runForever]	
Frameworks/Foundation.framework/Foundation___NSThread__start__	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 8·
/usr/lib/system/libsystem_kernel.dylib_mach_msg_trap	
/usr/lib/system/libsystem_kernel.dylib_mach_msg	
/usr/lib/system/libsystem_kernel.dylib_thread_suspend	
/Users/travis/build/bugsnag/bugsnag-unity/bugsnag-cocoa-build/Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_MachException.c:210:9ksmachexc_i_handleExceptions	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 9·
Thread 10·
/usr/lib/system/libsystem_kernel.dylib___psynch_cvwait	
/usr/lib/system/libsystem_pthread.dylib__pthread_cond_wait$VARIANT$mp	
/usr/lib/libc++.1.dylibstd::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&)	
Frameworks/JavaScriptCore.framework/JavaScriptCorevoid std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&)	
Frameworks/JavaScriptCore.framework/JavaScriptCorebmalloc::Scavenger::threadRunLoop()	
Frameworks/JavaScriptCore.framework/JavaScriptCorebmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*)	
Frameworks/JavaScriptCore.framework/JavaScriptCorevoid* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*)	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 11·
/usr/lib/system/libsystem_kernel.dylib_select$DARWIN_EXTSN	
Frameworks/CoreFoundation.framework/CoreFoundation___CFSocketManager	
/usr/lib/system/libsystem_pthread.dylib__pthread_body	
/usr/lib/system/libsystem_pthread.dylib__pthread_start	
Thread 12·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread	
Thread 13·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread	
Thread 14·
/usr/lib/system/libsystem_kernel.dylib___workq_kernreturn	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread

@chkuang-g
Copy link
Contributor

I see.
I think the reason of this crash is because the Analytics static library is holding a reference of FirebaseApp until the very end of the app life cycle. By the time when CppInstanceManager, which is also an static instance, is destroyed, il2cpp libraries has been unloaded or deallocated already.

I have added a task to track this bug. Will keep you updated.

@buihuuloc
Copy link

OK. Thank you!

@TonyPovey
Copy link

I'm also getting this issue, any further info or work arounds?

@ghost
Copy link

ghost commented Dec 18, 2018

Same here. Don't want to downgrade or leave a broken version in the app store over the christmas 🤐

@AlekseySimonenko
Copy link

We have the same crashes in our app in new version (Analytics & remote config sdk) Unity 2018.2.8f1

@MedushevskyV
Copy link

Same here. Really need a fix

@stewartmiles
Copy link
Contributor

@chkuang-g has a fix checked in, we're going through the process of QA'ing a build.

@gilgil28
Copy link
Author

Any updates?

@buihuuloc
Copy link

I think we should wait because of the holiday season

@kartikpatel1987
Copy link

any updates ?

@ozbra
Copy link

ozbra commented Jan 2, 2019

I hope you all had a great holiday time and ready to work. Because I didn't have. Please fix this problem or at least give us a work around as soon as possible. I am not able to manage my clients anymore. They demand to fix crashes and this problem even seems to be reason of terminating my contract.

@chkuang-g
Copy link
Contributor

We are managed to fix this issue and will include the fix in the next release.

This issue was introduced in 5.4.2 to fix the race condition when frequently create/destroy FirebaseApp.
The quick workaround is to revert the Firebase SDK version back to 5.4.1. If the app, mostly iOS app, crashes when FirebaseApp/FirebaseDatabase is created/destroyed, try to hold a reference to prevent it from being GCed.

Hope this help and wish you to have a happy new year.

@bklooster
Copy link

We are also seeing this crash log. Do you know when 5.4.4 will be released that will fix this problem?

@tudorpopa39
Copy link

I also have this issue. Any news?

@tholmgren
Copy link

Hi, I'm also having this issue but can't replicated it. Two questions. Does anyone know if the user is aware of the crash? 2) Is there an ETA for the update with the fix? Thanks.

@chkuang-g
Copy link
Contributor

Hi folks,

Good news. This issue is fixed in our latest 5.4.4 release.
Please let us know if you are still experiencing similar crash.

Shawn

@firebase firebase locked and limited conversation to collaborators Oct 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests