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

Specialize HTTP client for Apple platform to fix the connection issue while running in the background #211

Open
2 tasks
waahm7 opened this issue Nov 9, 2023 · 3 comments
Assignees
Labels
blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. feature-request A feature should be added or improved.

Comments

@waahm7
Copy link
Contributor

waahm7 commented Nov 9, 2023

Describe the feature

Follow up to awslabs/aws-sdk-swift#1086
Enable the CRT HTTP client to continue handling events in the background on Apple platform clients.

The standard event handling mechanism used by the CRT HTTP client (kqueue) is not fully supported on Apple platforms (i.e. native iOS/iPadOS, tvOS, macOS applications). Using the CRT HTTP client as-is on Apple platforms will result in broken connections if the application is not in the active state for the entire duration of the connection; this is a severe limitation for most use cases, especially for mobile devices where connection speeds are limited and users are restricted to one foreground app at a time.

To remedy this limitation, an alternative event handling mechanism ("dispatch queues") must be used on Apple platforms, since dispatch queues continue to handle events as expected throughout the application lifecycle. The CRT HTTP client will be modified to use the correct event handling mechanism when building for the platforms that require it.

Use Case

To enable efficient, background HTTP communications via the AWS SDK for Swift.

Proposed Solution

Use Apple platform-native event handling on Apple platforms, instead of CRT's current event handling which is based on POSIX threads.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@waahm7 waahm7 added needs-triage This issue or PR still needs to be triaged. feature-request A feature should be added or improved. labels Nov 9, 2023
@waahm7 waahm7 added this to the GA milestone Nov 9, 2023
@waahm7 waahm7 changed the title Specialize HTTP client for Apple platform to fix the connection issue while running in the background(short issue description) Specialize HTTP client for Apple platform to fix the connection issue while running in the background Nov 9, 2023
@jbelkins jbelkins removed the needs-triage This issue or PR still needs to be triaged. label Nov 13, 2023
@waahm7 waahm7 added the blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. label Jan 19, 2024
@waahm7
Copy link
Contributor Author

waahm7 commented Jan 19, 2024

blocked by awslabs/aws-sdk-swift#1307

@smivij smivij removed this from the GA milestone Mar 6, 2024
@sichanyoo
Copy link
Contributor

For macOS:

Tested using a simple dummy macOS application that uploads a 5GB file to S3 using CRT HTTP client.
When app is unfocused or minimized, it uploads the file successfully as expected.
When mac is put to sleep, it fails to upload the file as expected.
Conclusion: CRT HTTP client works fine on macOS.

However, for the scenario where mac is put to sleep, the application terminated unexpectedly. A follow-up ticket is created for this bug, and is getting worked on now.

*Follow-up ticket for the bug found: awslabs/aws-sdk-swift#1474

@sichanyoo
Copy link
Contributor

Closed awslabs/aws-sdk-swift#1307 as it's confirmed CRT HTTP client works as expected on macOS when the app is unfocused / minimized (expected success) and when app is suspended by mac being put to sleep (expected failure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

4 participants