Skip to content

fix(Auth): Refactoring state machine logic to fix memory leak #3613

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 4 commits into from
Apr 30, 2024

Conversation

harsh62
Copy link
Member

@harsh62 harsh62 commented Apr 15, 2024

Description

The PR aims at fixing memory leaks that have come up in Auth plugin with the usage of Async Sequence.

Rootcause:

  • Async stream is unable to notify state machine of early exits, which resulted in subscriber never getting removed and hence causing leaks.

Following are the changes that have been made.

  • Using combine framework to use CurrentValueSubject instead of maintaining the subscriptions ourselves.

Screenshot 2024-04-16 at 11 26 29 AM

Integration Test:

  • Integration Tests (Except DataStore & API)
  • Integration Tests | API - All
  • Integration Tests | DataStore - All

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

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

@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 16, 2024 04:24 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 15:59 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 temporarily deployed to IntegrationTest April 30, 2024 16:56 — with GitHub Actions Inactive
@harsh62 harsh62 merged commit d03f5a6 into main Apr 30, 2024
@harsh62 harsh62 deleted the async-sequence-refactor-wrapper-approach branch April 30, 2024 17:37
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