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

[BUG] PaymentSheetActivity.fetchConfig() race condition when activity recreates #3878

Closed
fbarthelery opened this issue Jun 24, 2021 · 2 comments · Fixed by #4034
Closed

[BUG] PaymentSheetActivity.fetchConfig() race condition when activity recreates #3878

fbarthelery opened this issue Jun 24, 2021 · 2 comments · Fixed by #4034
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@fbarthelery
Copy link

Summary

There is a race condition in PaymentSheetActivity.fetchConfig(). fetchConfig() is only called when the activity is created for the first time : link. The observation of viewModel.fetchFragmentConfig() triggers the transition to the next fragment : link.
It is possible for the activity to be recreated before getting a result from viewModel.fetchFragmentConfig(). In this case, transition to the next fragment doesn't happen and fetchConfig is not called during the onCreate() of the new fragment. This results in a PaymentSheet stuck in an infinite loading progress bar like #3744

Code to reproduce

As a race condition it may be hard to trigger. However, it happens consistently for me when calling PaymentSheet.presentWithPaymentIntent() from an activity in landscape. BaseSheetActivy requests a portrait orientation so PaymentSheetActivity is recreated.

Dependency Versions

stripe-android: 16.10.0

Gradle: 7.0

@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jun 24, 2021
@mshafrir-stripe
Copy link
Collaborator

@fbarthelery thanks for the detailed issue report. We'll investigate this.

@brnunes-stripe
Copy link
Contributor

Hi @fbarthelery, thanks for the details! Fixing this in #4034.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants