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

java.lang.IllegalArgumentException: View=DecorView@d9de0d2[ThreeDSecureActivity] not attached to window manager #982

Closed
francescocervone opened this issue Apr 30, 2024 · 3 comments

Comments

@francescocervone
Copy link

francescocervone commented Apr 30, 2024

Braintree SDK Version

4.45.0

Environment

Production

Android Version & Device

No response

Braintree dependencies

  • com.braintreepayments.api:card:4.45.0
  • com.braintreepayments.api:braintree-core:4.45.0
  • com.braintreepayments.api:data-collector:4.45.0
  • com.braintreepayments.api:google-pay:4.45.0
  • com.braintreepayments.api:paypal:4.45.0
  • com.braintreepayments.api:three-d-secure:4.45.0

Describe the bug

We are getting few crashes in production caused by com.cardinalcommerce.shared.userinterfaces.ProgressDialog.
We had this crash since forever, but it seems to be increased starting from Braintree 4.43 (I'll attach screenshots below).
Here you can find the stacktrace:

Fatal Exception: java.lang.IllegalArgumentException: View=DecorView@d9de0d2[getServiceWorkerController] not attached to window manager
       at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:544)
       at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:448)
       at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:206)
       at android.app.Dialog.dismissDialog(Dialog.java:413)
       at android.app.Dialog.dismiss(Dialog.java:395)
       at com.cardinalcommerce.shared.userinterfaces.ProgressDialog$2.run(SourceFile:52)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8152)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

For what it's worth, by reading our logs, it seems to be happening always after a 3D secure failure, usually with this stacktrace:

Caused by com.braintreepayments.api.BraintreeException: Cardinal SDK cca_continue Error.
       at com.braintreepayments.api.ThreeDSecureActivityResultContract.parseResult(ThreeDSecureActivityResultContract.java:44)
       at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:414)
       at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:371)
       at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:845)
       at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:151)
       at android.app.Activity.dispatchActivityResult(Activity.java:8893)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5489)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5535)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2405)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8152)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

It does not happen on a particular device (we have Xiaomi, Samsung, Motorola, Huawei,...) or an OS version (we have almost all of them, from 7 to 14)

It's just a guess, but it might be probably related to the memory leak mentioned here? #898

To reproduce

Unfortunately I'm not able to reproduce the issue on the sandbox.
Tested with some of the cards here and "Don't keep activities" flag on/off (which sometimes may cause issues like this).

Expected behavior

The app doesn't crash.

Screenshots

  • Orange line: Braintree 4.45.0
  • Blue line: Braintree 4.43.0
  • Pink line: Braintree 4.41.0

Screenshot 2024-04-30 at 11 16 54

@sarahkoop
Copy link
Contributor

Hi @francescocervone - Thanks for reporting this issue. We are actively investigating this and will post here when we have an update!

@francescocervone
Copy link
Author

Hi @sarahkoop is there any update about this issue?
It's our top issue with hundreds of crashes every month.
Thanks.

@sshropshire
Copy link
Contributor

Hello all. Please see version 4.48.0. We found a race condition recently where we were calling a CardinalSDK "cleanup" method too early, and applied a patch to resolve it. Feel free to re-open if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants