braintree_android icon indicating copy to clipboard operation
braintree_android copied to clipboard

Crash during 3DS when Android kills the app

Open alecarnevale opened this issue 2 years ago • 3 comments

General information

  • SDK/Library version: 4.14.0 (tested as reproducible also in 4.15.0)
  • Environment: Sandbox and Production
  • Android Version and Device: doesn't matter
  • Braintree dependencies: "com.braintreepayments.api:three-d-secure:4.14.0"

Issue description

The issue appears during a 3DS checkout. If user put the app in background and Android kills the app's process, when user returns to 3DS screen and proceed with 3DS the app crashes.

Step to reproduce

It's reproducible using Demo app:

  1. enable 3D secure from Settings;
  2. start using a credit card;
  3. fill the form and click on purchase;
  4. when 3DS screen appears, put the app in background;
  5. emulate an Android kill process (run am kill com.braintreepayments.demo in an adb shell, or tap on Terminate Application from logcat in AS);
  6. reopen the app from multitasking pane;
  7. complete 3DS checkout.
  8. crash occurs.

https://user-images.githubusercontent.com/43886303/187188130-bed1649e-21a2-4968-83de-355c33eb904e.mov

Stack trace

2022-08-29 12:55:34.563 8901-8901/com.braintreepayments.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.braintreepayments.demo, PID: 8901
    java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at com.cardinalcommerce.a.setEditableFactory.init(:2082)
        at com.cardinalcommerce.a.setOnEditorActionListener.Cardinal(:38564)
        at com.cardinalcommerce.a.setOnEditorActionListener$7.onClick(:389)
        at android.view.View.performClick(View.java:7441)
        at android.view.View.performClickInternal(View.java:7418)
        at android.view.View.access$3700(View.java:835)
        at android.view.View$PerformClick.run(View.java:28676)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-08-29 12:55:34.564 8901-8901/com.braintreepayments.demo E/Exception: Uncaught Exception
    java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at com.cardinalcommerce.a.setEditableFactory.init(:2082)
        at com.cardinalcommerce.a.setOnEditorActionListener.Cardinal(:38564)
        at com.cardinalcommerce.a.setOnEditorActionListener$7.onClick(:389)
        at android.view.View.performClick(View.java:7441)
        at android.view.View.performClickInternal(View.java:7418)
        at android.view.View.access$3700(View.java:835)
        at android.view.View$PerformClick.run(View.java:28676)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-08-29 12:55:35.148 8949-8949/com.braintreepayments.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.braintreepayments.demo, PID: 8949
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.braintreepayments.demo/com.braintreepayments.api.ThreeDSecureActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        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:2210)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at com.cardinalcommerce.cardinalmobilesdk.Cardinal.cca_continue(:21082)
        at com.braintreepayments.api.CardinalClient.continueLookup(CardinalClient.java:44)
        at com.braintreepayments.api.ThreeDSecureActivity.onCreateInternal(ThreeDSecureActivity.java:39)
        at com.braintreepayments.api.ThreeDSecureActivity.onCreate(ThreeDSecureActivity.java:28)
        at android.app.Activity.performCreate(Activity.java:8051)
        at android.app.Activity.performCreate(Activity.java:8031)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
        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:2210) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7839) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

alecarnevale avatar Aug 29 '22 11:08 alecarnevale

Hey @alecarnevale thanks for using the Braintree SDK for Android. We're working with Cardinal, our third-party MPI provider to resolve some issues related to Android 13.

In order to properly triage this issue, can you confirm that the same error occurs on a device/emulator running Android 12 or lower?

sshropshire avatar Aug 29 '22 14:08 sshropshire

can you confirm that the same error occurs on a device/emulator running Android 12 or lower?

Hi @sshropshire Yes, the error occurs for devices running Android 12 and lower.

alecarnevale avatar Aug 29 '22 15:08 alecarnevale

@alecarnevale ah my apoligies, I just noticed this is related directly related to process kill. I am able to reproduce this is specific to 3DS v2. I've notified our 3rd-party provider, we'll provide more details here as they become available.

sshropshire avatar Aug 29 '22 16:08 sshropshire

Hi @sshropshire, any update on this?

pier1287 avatar Oct 24 '22 08:10 pier1287

Hi @pier1287 thanks for your patience. We've notified Cardinal once again and we're waiting to hear back on next steps.

sshropshire avatar Oct 26 '22 14:10 sshropshire

I don't want to spam you, but hoping to help you prioritize this, I can add I also have this issue.

dcampogiani avatar Oct 26 '22 14:10 dcampogiani

@dcampogiani no worries. We appreciate all feedback, especially if we can forward it to Cardinal.

sshropshire avatar Oct 26 '22 15:10 sshropshire

Hi @sshropshire , Many of our users are also affected by this. Would be great if Cardinal solves it asap.

HeyPouya avatar Oct 27 '22 15:10 HeyPouya

Hi @SirLordPouya thanks for adding feedback. Cardinal has acknowledged the issue and is working on a set of next steps.

sshropshire avatar Oct 31 '22 18:10 sshropshire

Checking in here - is there any word on progress from Cardinal on this? It is our top crash at the moment and we're coming up on 4 months since this was opened.

Regarding crash distribution, these are the OS numbers we have:

34% Android 12
25% Android 11
17% Android 10
11% Android 13
13% Other (2)
36% samsung
15% OPPO
13% Xiaomi
13% HUAWEI
23% Other (7)

josephyanks avatar Dec 12 '22 14:12 josephyanks

Hi @josephyanks thanks for your patience. Cardinal is aware of the issue and has informed us they are working on a fix. Unfortunately we don't have a firm estimate on when the fix will be available.

Is there additional information you can provide about the overall impact on your application? If you prefer you can submit this to our support team and hopefully we can use this information to further escalate the issue.

sshropshire avatar Dec 12 '22 17:12 sshropshire

@sshropshire - at the moment, this accounts for roughly 10% of our crashes (our crash rate is relatively low, but this is definitely a standout). Is there information you're looking for specifically in regards to overall impact? We're nervous about any sort of crash related to 3DS since reproduction of the issues seems to be very dependent on the bank.

I will have our product team member reach out to the support team in the meantime - thank you for the link.

josephyanks avatar Dec 12 '22 17:12 josephyanks

Hi @sshropshire, any update on this?

caruspi avatar Mar 08 '23 13:03 caruspi

We are also impacted by this one.

dcampogiani avatar Mar 08 '23 13:03 dcampogiani

@dcampogiani unfortunately no. We're waiting on Cardinal, we were told sometime around March there would be an update with the fixes but we haven't heard anything yet.

sshropshire avatar Mar 21 '23 15:03 sshropshire

Do we know if we can expect this issue to be fixed?

dcampogiani avatar May 11 '23 07:05 dcampogiani

Hello, @sshropshire. It has been nearly a year since this issue was opened. Can you confirm whether Cardinal intends to address and resolve this issue?

GioIniguez avatar May 14 '23 20:05 GioIniguez

Happy Birthday to this issue!

alecarnevale avatar Aug 29 '23 07:08 alecarnevale

Happy Birthday to this issue!

We were told a few days ago by our PayPal contact that Cardinal has an internal fix for this and hopefully we'll finally be able to put this crash to bed. Here's to hoping at least.

josephyanks avatar Aug 29 '23 18:08 josephyanks

Thanks for your patience everyone! Cardinal's latest SDK release is included in braintree_android 4.38.1 and no longer crashes on background process kills. At this time, an error with be returned in this scenario and the user can retry.

sarahkoop avatar Sep 28 '23 20:09 sarahkoop