Skip to content

fix(auth): Prevent Rare Deadlock Scenario #2822

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

Merged
merged 2 commits into from
May 16, 2024
Merged

Conversation

tylerjroach
Copy link
Member

@tylerjroach tylerjroach commented May 15, 2024

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:
#2816

Description of changes:
If a subsequent auth call is called from within an auth onSuccess/onError callback with runBlocking, it can cause a deadlock. While this is a rare scenario, we can avoid with the changes in PR.

Amplify.Auth.fetchAuthSession( 
  {
    runBlocking {
      AmplifyKt.Auth.fetchAuthSession() 
    } 
  },
  {}
)

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tylerjroach tylerjroach marked this pull request as ready for review May 15, 2024 18:14
@tylerjroach tylerjroach requested a review from a team as a code owner May 15, 2024 18:14
@mattcreaser mattcreaser merged commit f29d7b7 into main May 16, 2024
3 checks passed
@mattcreaser mattcreaser deleted the tjroach/prevent-deadlocks branch May 16, 2024 18:18
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

Successfully merging this pull request may close these issues.

3 participants