chargebee / chargebee-flutter

MIT License
5 stars 9 forks source link

Crash reports #71

Open timeshift-ted opened 9 months ago

timeshift-ted commented 9 months ago

Crashlytics is reporting this crash is happening regularly:

Fatal Exception: java.lang.IllegalStateException Reply already submitted io.flutter.embedding.engine.dart.DartMessenger$Reply.reply (DartMessenger.java:435) io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error (MethodChannel.java:268) com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.error (ChargebeeFlutterSdkPlugin.kt:530) com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.onError (ChargebeeFlutterSdkPlugin.kt:511) com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.access$onError (ChargebeeFlutterSdkPlugin.kt:26) com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin$retrieveProducts$1.onError (ChargebeeFlutterSdkPlugin.kt:159) com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke (BillingClientManager.kt:51) com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke (BillingClientManager.kt:21) com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke (BillingClientManager.kt:69) com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke (BillingClientManager.kt:21) com.chargebee.android.billingservice.BillingClientManager$createBillingClientStateListener$1.onBillingServiceDisconnected (BillingClientManager.kt:504) com.android.billingclient.api.zzaf.onServiceDisconnected (com.android.billingclient:billing@@4.0.0:4) android.app.LoadedApk$ServiceDispatcher.doDeath (LoadedApk.java:1967) android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1982) android.os.Handler.handleCallback (Handler.java:883) android.os.Handler.dispatchMessage (Handler.java:100) android.os.Looper.loop (Looper.java:214) android.app.ActivityThread.main (ActivityThread.java:7356) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:930)

cb-amutha commented 9 months ago

thanks @timeshift-ted for sharing the logs here. As per the crash analytics logs, we could see the issue is while fetching the products from google store and unfortunately the app was unable to connect with google play billing service. Could you please add the test account of google play store and try again. Thanks.

And also, will try to replicate the same issue in our example app and update it.

timeshift-ted commented 9 months ago

Hi,

Can you please give me instructions on "add the test account of google play store"?

Ted Johnson Timeshift Media, Inc.

On Fri, Sep 8, 2023 at 3:35 AM Amutha C @.***> wrote:

thanks @timeshift-ted https://github.com/timeshift-ted for sharing the logs here. As per the crash analytics logs, we could see the issue is while fetching the products from google store and unfortunately the app was unable to connect with google play billing service. Could you please add the test account of google play store and try again. Thanks.

And also, will try to replicate the same issue in our example app and update it.

— Reply to this email directly, view it on GitHub https://github.com/chargebee/chargebee-flutter/issues/71#issuecomment-1711451574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUMDSQ2TZOTEWSGQGNCGY3XZLYFJANCNFSM6AAAAAA4PEDMDM . You are receiving this because you were mentioned.Message ID: @.***>

nikolashaag commented 8 months ago

Hi @cb-amutha ,

we have 120 reports of the same error since going live 1 month ago. Also through Crashlytics.

What causes the failure to connect to Google Play services here?

ciriousjoker commented 7 months ago

We also have this issue, but it's unclear why. I have a suspicion it's caused by the new default proguard rules in combination with a perhaps swallowed error, but I have no proof.

ciriousjoker commented 7 months ago

Here are stacktraces:

production via Crashlytics > Fatal Exception: java.lang.IllegalStateException: Reply already submitted > at bh.c$g.a(SourceFile:1) > at lh.k$a$a.b(SourceFile:1) > at b4.b.f(SourceFile:1) > at b4.b.h(SourceFile:1) > at b4.b.b(SourceFile:1) > at b4.b$i.onError(SourceFile:1) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:2) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:1) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:2) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:1) > at com.chargebee.android.billingservice.BillingClientManager$createBillingClientStateListener$1.onBillingServiceDisconnected(:15) > at u2.v.onServiceDisconnected(SourceFile:1) > at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:2382) > at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2397) > at android.os.Handler.handleCallback(Handler.java:942) > at android.os.Handler.dispatchMessage(Handler.java:99) > at android.os.Looper.loopOnce(Looper.java:226) > at android.os.Looper.loop(Looper.java:313) > at android.app.ActivityThread.main(ActivityThread.java:8762) > at java.lang.reflect.Method.invoke(Method.java) > at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) > at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) Interestingly, the underlying error message is this: > **flutter_error_exception** | PlatformException(502, java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType, java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType, null) > **flutter_error_reason** | thrown purchase() failed.
in debug mode Here, I opened the app, then logged into the Play Store on the emulator (might have called some callback in your sdk) and then resurfaced the app. > FATAL EXCEPTION: main > Process: com.dieringe.workout.debug, PID: 4621 > java.lang.IllegalStateException: Reply already submitted > at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:435) > at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:268) > at com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.error(ChargebeeFlutterSdkPlugin.kt:530) > at com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.onError(ChargebeeFlutterSdkPlugin.kt:511) > at com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin.access$onError(ChargebeeFlutterSdkPlugin.kt:26) > at com.chargebee.flutter.sdk.ChargebeeFlutterSdkPlugin$retrieveProducts$1.onError(ChargebeeFlutterSdkPlugin.kt:159) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(BillingClientManager.kt:51) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(BillingClientManager.kt:21) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(BillingClientManager.kt:69) > at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(BillingClientManager.kt:21) > at com.chargebee.android.billingservice.BillingClientManager$createBillingClientStateListener$1.onBillingServiceDisconnected(BillingClientManager.kt:511) > at com.android.billingclient.api.zzaf.onServiceDisconnected(com.android.billingclient:billing@@6.0.1:5) > at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:2218) > at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2233) > at android.os.Handler.handleCallback(Handler.java:958) > at android.os.Handler.dispatchMessage(Handler.java:99) > at android.os.Looper.loopOnce(Looper.java:205) > at android.os.Looper.loop(Looper.java:294) > at android.app.ActivityThread.main(ActivityThread.java:8177) > at java.lang.reflect.Method.invoke(Native Method) > at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) > at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

This suggests missing proguard rules. We're using chargebee_flutter: v0.2.1.

ciriousjoker commented 7 months ago

Issue is also reproducible in v0.3.0... this is affecting our production users who can't do purchases, please fix this asap.

ciriousjoker commented 7 months ago

Here are reproduction steps:

  1. Open Play Store
  2. Open the own app
  3. Open random other app
  4. Close Play Store
  5. Switch back to the app (it crashed)

Basically, closing the Play Store crashes the app if it's in the background. If it's in the foreground, nothing happens. ProGuard/no ProGuard makes no difference.

cb-haripriyan commented 7 months ago

Thanks for the steps to reproduce @ciriousjoker We are looking into this and will update here about the progress.

ciriousjoker commented 7 months ago

@cb-haripriyan Any news?

cb-haripriyan commented 6 months ago

We have identified the underlying case which was causing the multiple call backs. The Billing Library calls the listeners multiple times during disconnection/reconnection, which in turns causes multiple callbacks on Flutter. We are working on a method to avoid this.

ciriousjoker commented 6 months ago

@cb-haripriyan Any eta for this? This is severely affecting our users.

cb-haripriyan commented 6 months ago

@ciriousjoker We are targeting this for early next week.

ciriousjoker commented 6 months ago

@cb-haripriyan Do you have an update on this?

This issue produces almost 300 crashes per week on Android

cb-haripriyan commented 6 months ago

@ciriousjoker We are expecting to release a fix by utmost tomorrow. Apologies, we were delayed due to unforeseen circumstances.

cb-haripriyan commented 6 months ago

@ciriousjoker @timeshift-ted This should be fixed in the version 0.4.1. Can you please check and confirm?

ciriousjoker commented 6 months ago

Will try out asap, we'll probably have meaningful crash reporting statistics by the end of next week.

ciriousjoker commented 2 months ago

@cb-haripriyan This doesn't seem to happen nearly as often anymore as this one, but apparently it still exists in v1.0.0-beta.2.

Stacktrace

Fatal Exception: java.lang.IllegalStateException: Reply already submitted
       at lh.c$g.a(SourceFile:1)
       at uh.k$a$a.b(SourceFile:1)
       at h4.b.f(SourceFile:1)
       at h4.b.g(SourceFile:1)
       at h4.b.b(SourceFile:1)
       at h4.b$i.onError(SourceFile:1)
       at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:2)
       at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:1)
       at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:2)
       at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:1)
       at com.chargebee.android.billingservice.BillingClientManager$createBillingClientStateListener$1.onBillingServiceDisconnected(:15)
       at c3.u.onServiceDisconnected(SourceFile:1)
       at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:2226)
       at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2241)
       at android.os.Handler.handleCallback(Handler.java:959)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loopOnce(Looper.java:232)
       at android.os.Looper.loop(Looper.java:317)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

Perhaps this happens if a user signs into or out of the Play Store while the app is running?

cb-haripriyan commented 2 weeks ago

@ciriousjoker Missed updating it here. The version v1.0.0-beta.4 includes the fix for this.