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 Android: Global reference table overflow #2679

Closed
Davidnovarro opened this issue Apr 25, 2023 · 12 comments
Closed

Crashes on Android: Global reference table overflow #2679

Davidnovarro opened this issue Apr 25, 2023 · 12 comments
Assignees
Labels
P2 Issue. SDK Sdk engineering issue.

Comments

@Davidnovarro
Copy link

Davidnovarro commented Apr 25, 2023

  • Unity version: 2021.3.21f1
  • Google Mobile Ads Unity plugin version: 8.0.0
  • Platform: Android
  • Platform OS version: Android 11, 12
  • Any specific devices issue occurs on Nokia AKT (Nokia G300), Samsung a52q (Galaxy A52)
  • Mediation ad networks used, and their versions: Applovin 6.6.0, IronSource 7.3.0.0

I'm getting crash reports related to loading Interstitial ads from the Google Play dashboard. Here is a dump:
JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:


pid: 0, tid: 11865 >>> com.cooperbit.brawlparty <<<

backtrace:
#00 pc 0x000000000008bebc /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
#1 pc 0x00000000006f9f28 /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+472)
#2 pc 0x0000000000016ea8 /apex/com.android.art/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+80)
#3 pc 0x0000000000016450 /apex/com.android.art/lib64/libbase.so (android::base::LogMessage::~LogMessage()+352)
#4 pc 0x00000000003a3294 /apex/com.android.art/lib64/libart.so (art::JavaVMExt::AddGlobalRef(art::Thread*, art::ObjPtrart::mirror::Object)+1908)
#5 pc 0x00000000005e56c4 /apex/com.android.art/lib64/libart.so (art::JNI::NewGlobalRef(_JNIEnv*, _jobject*)+160)
#6 pc 0x0000000000114520 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (AndroidJNIBindingsHelpers::NewGlobalRef(void*))
#7 pc 0x0000000002813e48 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (GlobalJavaObjectRef__ctor_mFE5679D1B51F51CBF11721773C0D767286AC22E8)
#8 pc 0x0000000002817850 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (AndroidJavaObject__ctor_m0CEE7D570807333CE2C193A82AB3AB8D4F873A6B)
#9 pc 0x00000000028163cc /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (AndroidJavaObject_AndroidJavaObjectDeleteLocalRef_m2ECEEAF6389ABB9D6B963B8A98568ECD9413DF3C)
#10 pc 0x000000000105257c /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (AndroidJavaObject__Call_TisRuntimeObject_m6B809BA99521C27E9641C9A6C5C46A3385ED7B14_gshared)
#11 pc 0x000000000281b538 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (_AndroidJNIHelper_GetSignature_m414A7A6B98FB5565075E4C51F22C482F2BCEEF5F)
#12 pc 0x000000000281a610 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (_AndroidJNIHelper_GetSignature_m309D35CC998B59CFEDA2D6EB5D0E221B3F1374F7)
#13 pc 0x0000000002816924 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (AndroidJavaObject__AndroidJavaObject_m1284CB7198514B8C06A2BF794ACDC909DC26443F)
#14 pc 0x0000000001f7cf1c /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (InterstitialClient__ctor_m0046CDB719B03D590B6E356A884B10D1EAF173E5)
#15 pc 0x0000000001f7cca4 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (GoogleMobileAdsClientFactory_BuildInterstitialClient_mBA16B22AAB2CA58F48437FAADA0DCEB4C1FAA1CE)
#16 pc 0x0000000001f87d88 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (InterstitialAd_Load_m7582DD601991C297C7E7E61BBE53B639466A73A1)
#17 pc 0x00000000008bc2ac /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (Tools_SafeInvoke_TisInterstitialAd_t41640B3957C2B66FA5F6F38A4805393B6B013FEC_TisLoadAdError_t22654493F27C801157B803019F04E69E66CD4A62_mE9DD453EE093B788707696645BE1DD3B77785CAB_inline(Action_2_t6D103D50D92EED8806671DABC525008F7D560A68*, InterstitialAd_t41640B3957C2B66FA5F6F38A4805393B6B013FEC*, LoadAdError_t22654493F27C801157B803019F04E69E66CD4A62*, MethodInfo const*))
#18 pc 0x0000000001f86050 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (MobileAdsEventExecutor_Update_mA2FA865A80DE36FC26CAD15783037324C74D5113)
#19 pc 0x0000000000ad6650 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**))
#20 pc 0x0000000000ad64c4 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libil2cpp.so (il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**))
#21 pc 0x00000000002fd978 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool))
#22 pc 0x000000000030c588 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool))
#23 pc 0x0000000000319f64 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (MonoBehaviour::CallUpdateMethod(int))
#24 pc 0x000000000018e58c /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (void BaseBehaviourManager::CommonUpdate())
#25 pc 0x000000000022c5d0 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*))
#26 pc 0x000000000022c610 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*))
#27 pc 0x000000000022c848 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (PlayerLoop())
#28 pc 0x0000000000387250 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (UnityPlayerLoop())
#29 pc 0x000000000039d684 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/lib/arm64/libunity.so (nativeRender(_JNIEnv*, _jobject*))
#30 pc 0x00000000000777a4 /data/app/~~kwV9ONBX0eRZ4MofoZqsOQ==/com.cooperbit.brawlparty-QY6nTh2-ebhv2N81Olb8ew==/oat/arm64/base.odex

@NVentimiglia
Copy link
Member

Hi @Davidnovarro

To confirm, you are not able to replicate this issue locally and it only appears on the google play dashboard? If so, can you create a support ticket here? please include your publisher id, app id, and a link to issue. A minimal sample app would also be helpful.

@NVentimiglia NVentimiglia self-assigned this Apr 26, 2023
@NVentimiglia NVentimiglia added P2 Issue. Integration Issue SDK Sdk engineering issue. labels Apr 26, 2023
@DevDreams12
Copy link

same problem

@Davidnovarro
Copy link
Author

After an investigation, I found out that the issue was mostly in some countries, and on some devices where no ad was returned by Admob. And in those cases, I was constantly requesting new ads right after the "ad failed to load" response.

I've added an exponential delay (2 seconds, 4s, 8s, 16...) before retrying and I confirm fixed the problem.

This issue can be closed.

@DevDreams12
Copy link

Can you show example of implementation for interstitial ad load with delay like you described. I would be very thankful because I'm getting a lot of crash reports from my game because this issue.

@Davidnovarro
Copy link
Author

Davidnovarro commented May 15, 2023

You can do something like this

void OnRewardedAdFailedEvent()
{
          // Rewarded ad failed to load. We recommend retrying with exponentially higher delays up to a maximum delay (in this case 64 seconds).
          rewardedRetryAttempt++;
          double retryDelay = Math.Pow(2, Math.Min(6, rewardedRetryAttempt));
          Invoke("LoadRewardedAd", (float) retryDelay);
}

@DevDreams12
Copy link

DevDreams12 commented May 15, 2023

I have implemented it yesterday like this and the crashes table overflow are gone with new version:

private void SetInterstitialAdEvent()
{
_interstitialAd.OnAdClosed += (sender, args) =>
{
StartLoadingCoroutine();
};
_interstitialAd.OnAdFailedToLoad += (sender, args) =>
{
StartLoadingCoroutine();
};
}

private void StartLoadingCoroutine()
{
    if (loadingCoroutine != null)
    {
        StopCoroutine(loadingCoroutine);
    }
    loadingCoroutine = StartCoroutine(ExponentialDelayCoroutine());
}

private IEnumerator ExponentialDelayCoroutine()
{
    float delay = 1f; // Start delay (1 second)

    while (!_interstitialAd.IsLoaded())
    {
        Debug.Log("Interstitial ad is not loaded. Retrying in " + delay + " seconds...");
        yield return new WaitForSeconds(delay);

        delay *= 2; // Exponential delay (double the previous delay)
        if (delay > 16f)
        {
            delay = 16f; // Cap the delay at 16 seconds
        }

        _interstitialAd.LoadAd(new AdRequest.Builder().Build());
    }
}


public void ShowInterstitialAd()
{
    if (_interstitialAd != null && _interstitialAd.IsLoaded())
    {
        Debug.Log("Showing interstitial ad....");
        _interstitialAd.Show();
    }
    else
    {
        Debug.LogError("Interstitial ad is not ready yet.");
    }
}`

@DevDreams12
Copy link

What do you think? Good Solution for efficiency or adding like you delay till 64 seconds not max 16 seconds?

@Davidnovarro
Copy link
Author

What do you think? Good Solution for efficiency or adding like you delay till 64 seconds not max 16 seconds?

I would increase the delay untill 1 minute.

@DevDreams12
Copy link

Quick Update:

I have updated the plugin because of ANRs to 8.2.0 but now my implementation with delay don't work anymore. Can you please show me full solution of your implementation? I would be very thankful because now my players getting table overflow crashes again. Over 1k gettings these crashes again

@Davidnovarro
Copy link
Author

My solution is complicated with a lot of abstraction, not sure if that would make your life easier but anyways I can send it in a zipped folder if you'll leave your email here, so you can figure it out by yourself.

But overall you should call "LoadAd: once and on "Failed Callback" you should check how many attempts were done previously and based on that number calculate a delay.

Here is a simple example from Applovin
https://dash.applovin.com/documentation/mediation/unity/ad-formats/interstitials

@DevDreams12
Copy link

Thats my E-Mail: champstudios02@gmail.com.
Thank you brother!

@Davidnovarro
Copy link
Author

Davidnovarro commented May 17, 2023

Thats my E-Mail: champstudios02@gmail.com. Thank you brother!

Done, also I forgot to mention that you need to call Destroy() methods on ad instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Issue. SDK Sdk engineering issue.
Projects
None yet
Development

No branches or pull requests

3 participants