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

NullPointerException in AddPaymentMethodViewController #100

Closed
icaspi opened this issue May 20, 2016 · 14 comments
Closed

NullPointerException in AddPaymentMethodViewController #100

icaspi opened this issue May 20, 2016 · 14 comments

Comments

@icaspi
Copy link

icaspi commented May 20, 2016

Hey,

We are seeing the following crash in production, not sure what make of it:

Caused by java.lang.NullPointerException
       at com.braintreepayments.api.AddPaymentMethodViewController.initViews(AddPaymentMethodViewController.java:76)
       at com.braintreepayments.api.AddPaymentMethodViewController.(AddPaymentMethodViewController.java)
       at com.braintreepayments.api.BraintreePaymentActivity.initAddPaymentMethodView(BraintreePaymentActivity.java:280)
       at com.braintreepayments.api.BraintreePaymentActivity.showAddPaymentMethodView(BraintreePaymentActivity.java:271)
       at com.braintreepayments.api.BraintreePaymentActivity.onPaymentMethodNoncesUpdated(BraintreePaymentActivity.java:148)
       at com.braintreepayments.api.BraintreePaymentActivity.onCreate(BraintreePaymentActivity.java:120)

Looks like the CardForm is failing to initialize but I'm not sure why.

Cheers!

@sdcoffey
Copy link

Hey @icaspi,

Thanks for bringing this up, and congrats on filing bug #100! What version of the SDK are you using? I'll take a look this morning.

@icaspi
Copy link
Author

icaspi commented May 20, 2016

@sdcoffey Not sure which version gradle is pointing to com.braintreepayments.api:braintree:2.+, com.braintreepayments.api:drop-in:2.+

@sdcoffey
Copy link

Hey @icaspi,

Are you seeing this crash in the wild? This is a weird one. Basically, what's happening is that BraintreeFragment's Configuration object is absent on creation of the AddPaymentmethodViewController, however, AddPaymentMethodViewController really can't be instantiated without a valid Configuration. Could be a GC timing issue, do you have any other information about the devices this crash is happening on?

@sdcoffey
Copy link

Hey @icaspi,

Just wanted to check in, are you still seeing this issue?

@icaspi
Copy link
Author

icaspi commented May 25, 2016

Hey @sdcoffey

I checked our logs again, it looks like that the app is in a real funny state (going up or down not sure) so it could be that the api is just a passenger in this accident

@sdcoffey
Copy link

@icaspi, hm that's strange. I'm going to close this for now, then. Please reopen this issue if it rears its ugly head again.

@DuoBlood
Copy link

DuoBlood commented Jun 1, 2016

Hi @sdcoffey!
The issues is reaper again.

compile "com.braintreepayments.api:braintree:2.3.1"
compile "com.braintreepayments.api:drop-in:2.3.1"
Caused by java.lang.NullPointerException
com.braintreepayments.api.AddPaymentMethodViewController.initViews (AddPaymentMethodViewController.java:75)
com.braintreepayments.api.AddPaymentMethodViewController.<init> (AddPaymentMethodViewController.java:54)
com.braintreepayments.api.BraintreePaymentActivity.initAddPaymentMethodView (BraintreePaymentActivity.java:280)
com.braintreepayments.api.BraintreePaymentActivity.showAddPaymentMethodView (BraintreePaymentActivity.java:271)
com.braintreepayments.api.BraintreePaymentActivity.onCreate (BraintreePaymentActivity.java:118)

steps:

  • open app (it can be demo)
  • open Drop-In
  • minimize the app
  • kill app process
  • re-lunch the app

@lkorth lkorth reopened this Jun 1, 2016
@sdcoffey
Copy link

sdcoffey commented Jun 1, 2016

Thanks @DuoBlood,

The steps to repro are super helpful. Is there a specific device that this is happening on?

@DuoBlood
Copy link

DuoBlood commented Jun 2, 2016

@sdcoffey

  • Google Nexus 5 - Android 6.0.1;
  • Sony XPERIA Z5 - Android 5.1.1;
  • Lenovo A328 – Android 4.4.2;
  • HTC One M7 – Android 4.4.2

@sdcoffey
Copy link

sdcoffey commented Jun 6, 2016

@DuoBlood

Can you confirm those repro steps? We are not able to reproduce this issue on any device.

@DuoBlood
Copy link

DuoBlood commented Jun 6, 2016

@sdcoffey

I recorded a movie (skipped downloading)

@sdcoffey
Copy link

sdcoffey commented Jun 6, 2016

@DuoBlood

Thanks for taking the time to record a video! It looks like you're stopping the process via ADB, and then re-opening the app. Is this the only way you're able to reproduce the crash? I would argue that such an action is well outside the bounds of what a user would actually encounter.

@DuoBlood
Copy link

DuoBlood commented Jun 7, 2016

@sdcoffey

The first time it happened without using ADB (same steps).
I thought that Android kills activity which are running in the background when there is a need for memory. So I only emulated this situation, and caught it.

@sdcoffey
Copy link

sdcoffey commented Jun 7, 2016

@DuoBlood

Ah, ok, thanks for the clarification. Our team member @quinnjn was able to replicate it by enabling these options in dev tools:

- Background process limit: No background processes
- Don’t keep activities

Thanks again for working with us on this, I'll keep you posted as we put a fix in.

@lkorth lkorth closed this as completed in ee01127 Jun 16, 2016
lkorth pushed a commit that referenced this issue Jun 16, 2016
Fix #100 - address race condition in drop in initialization
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

4 participants