appsflyer-react-native-plugin icon indicating copy to clipboard operation
appsflyer-react-native-plugin copied to clipboard

Android Crash - "Callback arg cannot be called more than once";

Open mobinni opened this issue 11 months ago • 14 comments

Report

Plugin Version

6.15.1

On what Platform are you having the issue?

Android only

What did you do?

We use logEvent

What did you expect to happen?

logEvent callbacks not to crash on Android

What happened instead?

On new arch in production for Android we receive crash logs where onError callback is called, but invoked twice which causes a crash to trigger;

react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp
      if (!callback) {
          LOG(FATAL) << "Callback arg cannot be called more than once";
          return;
        }
  #10  pc 0x000000000060cb00  /data/app/~~fd4r20TdR3MOOG2sjAaVtg==/com.wealthsimple.trade-dfI26diei0-qwrUPNR0eeg==/base.apk (com.facebook.react.bridge.CxxCallbackImpl.invoke+8)
  #11  pc 0x0000000000780ee4  /apex/com.android.art/lib64/libart.so (nterp_helper+7540)
  #12  pc 0x0000000000879a18  /data/app/~~fd4r20TdR3MOOG2sjAaVtg==/com.*.*-dfI26diei0-qwrUPNR0eeg==/base.apk (com.appsflyer.reactnative.RNAppsFlyerModule$3.onError+12)
  #13  pc 0x0000000000780ee4  /apex/com.android.art/lib64/libart.so (nterp_helper+7540)
  #14  pc 0x0000000000861500  /data/app/~~fd4r20TdR3MOOG2sjAaVtg==/com.*.*-dfI26diei0-qwrUPNR0eeg==/base.apk (com.appsflyer.internal.AFf1pSDK.AFAdRevenueData+116)

Please provide any other relevant information.

Im not sure how the double invocation happens, based on google play console it happens mostly on backgrounding. I could repro the issue by manually double invoking a callback. Based on the codepaths I see that we trigger the error callback in the try / catch as well as onError, there might be some type of condition being hit here where the error happens in logEvent natively gets thrown up and handled again?

mobinni avatar Jan 15 '25 21:01 mobinni