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

SIGSEGV Libunity.so Crashes #2854

Closed
MuhammadWaqasOfficial opened this issue Aug 6, 2023 · 15 comments
Closed

SIGSEGV Libunity.so Crashes #2854

MuhammadWaqasOfficial opened this issue Aug 6, 2023 · 15 comments
Assignees
Labels
Support General question, Installation question, or feedback.

Comments

@MuhammadWaqasOfficial
Copy link

MuhammadWaqasOfficial commented Aug 6, 2023

Step 1: Describe your environment

  • Unity version: Not Matter
  • Google Mobile Ads Unity plugin version: 7.4, 8.2.0
  • Platform: Android

[REQUIRED] Step 2: Describe the problem

We are experiencing lot of crashes and tried everything from changing unity version to different admob version. Almost our every game on play store getting similar crashes. we didn't got any help from unity forums.
one thing I didn't tried is removing admob to confirm if it related to admob.

Posting here, might be its related to admob(someone previously posted similar crash #1171 with having DelayedCallManager in backtrace and I am also seeing DelayedCallManager in my crashes trace)


backtrace:
00 /lib/arm/libunity.so (void std::__ndk1::__tree_balance_after_insert<std::__ndk1::__tree_node_base<void*>>(std::__ndk1::__tree_node_base<void>, std::__ndk1::__tree_node_base<void>))
01 /lib/arm/libunity.so (std::__ndk1::__tree<DelayedCallManager::Callback, std::__ndk1::lessDelayedCallManager::Callback, memory_poolDelayedCallManager::Callback>::__insert_node_at(std::__ndk1::__tree_end_node<std::__ndk1::__tree_node_base<void
>>, std::__ndk1::__tree_node_base<void*>&, std::__ndk1::__tree_node_base<void>))
02 /lib/arm/libunity.so (std::__ndk1::__tree_iterator<DelayedCallManager::Callback, std::__ndk1::__tree_node<DelayedCallManager::Callback, void
>, int> std::__ndk1::__tree<DelayedCallManager::Callback, std::__ndk1::lessDelayedCallManager::Callback, memory_poolDelayedCallManager::Callback>::__emplace_multi<DelayedCallManager::Callback const&>(DelayedCallManager::Callback const&))
03 /lib/arm/libunity.so (CallDelayed(CallObjectState (
)(Object*, void*), PPtr, float, void*, float, CallObjectState ()(void), DelayedCallManager::DelayedCallMode))
04 /lib/arm/libunity.so (InvokeDelayed(MonoBehaviour&, char const*, float, float))
05 /lib/arm/libunity.so (MonoBehaviour_CUSTOM_InvokeDelayed(ScriptingBackendNativeObjectPtrOpaque*, ScriptingBackendNativeStringPtrOpaque*, float, float))
06 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)+578)
07 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)+564)
08 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::InvokeConvertArgs(MethodInfo const*, void*, Il2CppObject**, int, Il2CppException**)+720)
09 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::InvokeArray(MethodInfo const*, void*, Il2CppArray*, Il2CppException**)+616)
10 /lib/arm/libil2cpp.so (il2cpp::icalls::mscorlib::System::Reflection::RuntimeMethodInfo::InternalInvoke(Il2CppReflectionMethod*, Il2CppObject*, Il2CppArray*, Il2CppException**)+186)
11 /lib/arm/libil2cpp.so (RuntimeMethodInfo_Invoke_m8051178526027CCDA6D5EAC06792B901430EBC70+30568)
12 /lib/arm/libil2cpp.so (MethodBase_Invoke_mEEF3218648F111A8C338001A7804091A0747C826+132)
13 /lib/arm/libil2cpp.so (AndroidJavaProxy_Invoke_m9D765F3E7DC37C5CB14C4884F2873B48D2F96BFB+7277)
14 /lib/arm/libil2cpp.so (_AndroidJNIHelper_InvokeJavaProxyMethod_mCA9BD35B5AE99B6DFABBFE9968DD1EBE931F70C2+54)
15 /lib/arm/libil2cpp.so (RuntimeInvoker_FalseIntPtr_t_RuntimeObject_IntPtr_t_IntPtr_t(void ()(), MethodInfo const, void*, void**, void*)+47869)
16 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)+588)
17 /lib/arm/libil2cpp.so (il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)+564)
18 /lib/arm/libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool))
19 /lib/arm/libunity.so (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool))
20 /lib/arm/libunity.so (UnityJavaProxy_invoke(_JNIEnv*, _jobject*, long long, _jstring*, _jobjectArray*))
21 /oat/arm/base.odex (art_jni_trampoline+156)
22 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68)
23 /apex/com.android.art/lib/libart.so (art_quick_invoke_static_stub+276)
24 /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+166)
25 /apex/com.android.art/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+254)
26 /apex/com.android.art/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+738)
27 /apex/com.android.art/lib/libart.so (MterpInvokeStatic+490)
28 /apex/com.android.art/lib/libart.so (mterp_op_invoke_static+20)
29 /data/app/~~Jr0WRqp7pu68WcoavS5_mg==/game.package.name-OSlT_wbwqnDU4_OHTOjcbQ==/oat/arm/base.vdex (com.unity3d.player.ReflectionHelper.a)
30 /apex/com.android.art/lib/libart.so (MterpInvokeStatic+1096)
31 /apex/com.android.art/lib/libart.so (mterp_op_invoke_static+20)
32 /data/app/~~Jr0WRqp7pu68WcoavS5_mg==/game.package.name-OSlT_wbwqnDU4_OHTOjcbQ==/oat/arm/base.vdex (com.unity3d.player.ReflectionHelper$1.invoke+58)
33 /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.9340319512448905645)+248)
34 /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+120)
35 /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+698)
36 /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+32)
37 /apex/com.android.art/javalib/arm/boot.oat (java.lang.reflect.Proxy.invoke+68)
38 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68)
39 /apex/com.android.art/lib/libart.so (art_quick_invoke_static_stub+276)
40 /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+166)
41 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithJValuesart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+350)
42 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+42)
43 /apex/com.android.art/lib/libart.so (art::JNI::CallStaticObjectMethodA(_JNIEnv*, _jclass*, _jmethodID*, jvalue const*)+524)
44 /apex/com.android.art/lib/libart.so (art::InvokeProxyInvocationHandler(art::ScopedObjectAccessAlreadyRunnable&, char const*, _jobject*, _jobject*, std::__1::vector<jvalue, std::__1::allocator >&)+472)
45 /apex/com.android.art/lib/libart.so (artQuickProxyInvokeHandler+996)
46 /apex/com.android.art/lib/libart.so (art_quick_proxy_invoke_handler+20)
47 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68)
48 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub+282)
49 /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+148)
50 /apex/com.android.art/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+254)
51 /apex/com.android.art/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+738)
52 /apex/com.android.art/lib/libart.so (MterpInvokeInterface+892)
53 /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+20)
54 /data/app/~~Jr0WRqp7pu68WcoavS5_mg==/game.package.name-OSlT_wbwqnDU4_OHTOjcbQ==/oat/arm/base.vdex (com.google.unity.ads.UnityRewardedAd$1$1$4.run+48)
55 /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.9340319512448905645)+248)
56 /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+120)
57 /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+698)
58 /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+32)
59 /apex/com.android.art/javalib/arm/boot.oat (java.lang.Thread.run+64)
60 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub_internal+68)
61 /apex/com.android.art/lib/libart.so (art_quick_invoke_stub+282)
62 /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+148)
63 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValuesart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+374)
64 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+42)
65 /apex/com.android.art/lib/libart.so (art::Thread::CreateCallback(void*)+1056)
66 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40)
67 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30)

image
CrashList
Crash.txt
Cleaned_Backtrace.txt

@dendyak
Copy link

dendyak commented Aug 6, 2023

Did you try to remove all callbacks? I mean callbacks for bannerview or interstitials like OnAdClosed , OnAdFailedToLoad and so on.
For now have the same problem for Unity plugin version 7.3.1 and Unity version 2022.2.9

@MuhammadWaqasOfficial
Copy link
Author

Did you try to remove all callbacks? I mean callbacks for bannerview or interstitials like OnAdClosed , OnAdFailedToLoad and so on. For now have the same problem for Unity plugin version 7.3.1 and Unity version 2022.2.9

not using callbacks for banner, but for interstitial, rewarded, rewarded interstitial i am using callback.
No, i didn't remove them and can't remove them as i need them for rewards/loadnext ad etc.

Today i am giving update of one of my game without admob to see if it is related to admob.

@dendyak
Copy link

dendyak commented Aug 7, 2023

Did you try to remove all callbacks? I mean callbacks for bannerview or interstitials like OnAdClosed , OnAdFailedToLoad and so on. For now have the same problem for Unity plugin version 7.3.1 and Unity version 2022.2.9

not using callbacks for banner, but for interstitial, rewarded, rewarded interstitial i am using callback. No, i didn't remove them and can't remove them as i need them for rewards/loadnext ad etc.

Today i am giving update of one of my game without admob to see if it is related to admob.

Yes, interesting to find out is it about admob. I will try to use UnityMainThreadDispatcher in all admob-callbacks. (https://github.com/PimDeWitte/UnityMainThreadDispatcher/tree/master)

@MuhammadWaqasOfficial
Copy link
Author

Did you try to remove all callbacks? I mean callbacks for bannerview or interstitials like OnAdClosed , OnAdFailedToLoad and so on. For now have the same problem for Unity plugin version 7.3.1 and Unity version 2022.2.9

not using callbacks for banner, but for interstitial, rewarded, rewarded interstitial i am using callback. No, i didn't remove them and can't remove them as i need them for rewards/loadnext ad etc.
Today i am giving update of one of my game without admob to see if it is related to admob.

Yes, interesting to find out is it about admob. I will try to use UnityMainThreadDispatcher in all admob-callbacks. (https://github.com/PimDeWitte/UnityMainThreadDispatcher/tree/master)

hey, after months 1 thing i found different from my other games not having crash is
MobileAds.RaiseAdEventsOnUnityMainThread = true;
Games without crashes have this line. and games with crashes don't have this line.
can you confirm with your ad code.

@dendyak
Copy link

dendyak commented Aug 7, 2023

I never use MobileAds.RaiseAdEventsOnUnityMainThread = true; but will try. I read in other thread that it does not help (#2611). That is why I want to try UnityMainThreadDispatcher.

@MuhammadWaqasOfficial
Copy link
Author

I never use MobileAds.RaiseAdEventsOnUnityMainThread = true; but will try. I read in other thread that it does not help (#2611). That is why I want to try UnityMainThreadDispatcher.

you can try
MobileAds.RaiseAdEventsOnUnityMainThread = true;
RequestConfiguration requestConfiguration = new RequestConfiguration.Builder()
.SetMaxAdContentRating(GetMaxAdContentRating())//e.g fun return MaxAdContentRating.MA
.SetSameAppKeyEnabled(IsPrivacyPolicyAccepted)//true/false based on privacy policy accepted or not.
.SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.False)
.build();

@dendyak
Copy link

dendyak commented Aug 7, 2023

thanks i will try

@MuhammadWaqasOfficial
Copy link
Author

MuhammadWaqasOfficial commented Aug 7, 2023

thanks i will try

i am not using UMP and My admob is 8.2.0

@NVentimiglia
Copy link
Member

@MuhammadWaqasOfficial

The stack trace indicates that the crash is originating from the native platform, but does not specifically call out google as the source. The the other participants are correct in suggesting the use of RaiseAdEventsOnUnityMainThread as a work around. Generally native platform calls are dispatched on background threads which cause exceptions if they touch Unity objects. The RaiseAdEventsOnUnityMainThread catches native calls from Google and resends them on the unity main thread so that they are safe.

Please try this out.

@NVentimiglia NVentimiglia self-assigned this Aug 7, 2023
@NVentimiglia NVentimiglia added the Support General question, Installation question, or feedback. label Aug 7, 2023
@MuhammadWaqasOfficial
Copy link
Author

@dendyak thanks for giving the lead/direction to look for. Crash is resolved.
@NVentimiglia although this specific backtrace don't give any lead related to admob or google but issue is indirectly related to admob. Adding
MobileAds.RaiseAdEventsOnUnityMainThread = true;
resolved the issue.

In testing or in most devices it didn't raise any crash but somehow crashes occurred on real players. This crash takes almost 2 to 7 percent of total crash in my every game.

My suggestion is that on developer guide you must mention and force user to set
MobileAds.RaiseAdEventsOnUnityMainThread = true;
if user is using new ad events and callbacks implementation. As clearly ad events and callbacks directly dependent on RaiseAdEventsOnUnityMainThread value.

I know they mention in developer guide to use MobileAds.RaiseAdEventsOnUnityMainThread = true; for raising events in main thread. But they didn't mention RaiseAdEventsOnUnityMainThread and events has dependency and crash might occur.

If you need any type of crash related data from firebase crashlytics or play console, i will provide.

Regards

@NVentimiglia
Copy link
Member

MobileAds.RaiseAdEventsOnUnityMainThread = true;

Thats great, and also confirms that the native calls was google mobile ads.

As a note, Google mobile ads is not thread safe and does not always return events and callbacks on the unity main thread, which can cause issues when touching unity engine objects.

@nintendaii
Copy link

Hey guys. I am facing same issue. I tried to add

MobileAds.RaiseAdEventsOnUnityMainThread = true;

But no luck. I was wondering, where should I put this line? Before or after MobilaAds initialization? Maybe the problem is not solved because I put this line before Initialization

@dendyak
Copy link

dendyak commented Jan 29, 2024

MobileAds.RaiseAdEventsOnUnityMainThread 

in my case only using MobileAdsEventExecutor helps to avoid such crashes:
#1171 (comment)

@nintendaii
Copy link

MobileAds.RaiseAdEventsOnUnityMainThread 

in my case only using MobileAdsEventExecutor helps to avoid such crashes: #1171 (comment)

And where did u put this line? Before or after mobile ads initialization?

@dendyak
Copy link

dendyak commented Jan 29, 2024

MobileAds.RaiseAdEventsOnUnityMainThread 

in my case only using MobileAdsEventExecutor helps to avoid such crashes: #1171 (comment)

And where did u put this line? Before or after mobile ads initialization?

I use MobileAdsEventExecutor on every callback, including initialization callback. See my comment on other thread:
#1171 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support General question, Installation question, or feedback.
Projects
None yet
Development

No branches or pull requests

4 participants