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

fix(api): storing cancelablles with actor methods in AppSyncRTC #3824

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Conversation

5d
Copy link
Member

@5d 5d commented Aug 20, 2024

Issue #

#3748

Description

The potential crash is caused by the non thread-safe AnyCancellable.store(in:) API. This PR ensures that all cancellable properties are accessed within an isolated actor context.

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.

Copy link
Contributor

API Breakage Report

✅ No Public API Breaking Change detected

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.37%. Comparing base (bdfa37a) to head (ce52581).
Report is 2 commits behind head on main.

Files Patch % Lines
.../AppSyncRealTimeClient/AppSyncRealTimeClient.swift 89.28% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3824      +/-   ##
==========================================
- Coverage   68.62%   68.37%   -0.25%     
==========================================
  Files        1080     1082       +2     
  Lines       37635    37731      +96     
==========================================
- Hits        25827    25800      -27     
- Misses      11808    11931     +123     
Flag Coverage Δ
API_plugin_unit_test 69.32% <89.28%> (+0.36%) ⬆️
AWSPluginsCore 68.53% <ø> (-0.03%) ⬇️
Amplify 47.56% <ø> (ø)
Analytics_plugin_unit_test 84.52% <ø> (ø)
Auth_plugin_unit_test 79.20% <ø> (-0.46%) ⬇️
DataStore_plugin_unit_test 81.30% <ø> (-0.99%) ⬇️
Geo_plugin_unit_test 72.00% <ø> (ø)
Logging_plugin_unit_test 62.95% <ø> (ø)
Predictions_plugin_unit_test 36.86% <ø> (ø)
PushNotifications_plugin_unit_test 86.21% <ø> (ø)
Storage_plugin_unit_test 76.84% <ø> (+0.02%) ⬆️
unit_tests 68.37% <89.28%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

API Breakage Report

✅ No Public API Breaking Change detected

@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:10 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d had a problem deploying to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Failure
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:11 — with GitHub Actions Inactive
@5d 5d temporarily deployed to IntegrationTest August 20, 2024 22:32 — with GitHub Actions Inactive
@5d 5d marked this pull request as ready for review August 20, 2024 22:43
@5d 5d requested a review from a team as a code owner August 20, 2024 22:43
lawmicha
lawmicha previously approved these changes Aug 23, 2024
@@ -425,24 +430,37 @@ extension AppSyncRealTimeClient {
}
}

private func monitorHeartBeats(_ connectionAck: JSONValue?) {
internal func monitorHeartBeats(_ connectionAck: JSONValue?) {
Copy link
Contributor

@lawmicha lawmicha Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can probably omit internal as that is the default when no access level is specified

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will remove the modifier!

@5d 5d merged commit 8189460 into main Aug 23, 2024
79 checks passed
@5d 5d deleted the 5d/fix-3748 branch August 23, 2024 17:41
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.

2 participants