-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
Describe the bug
When uploading a file using S3Client.putObject(input:) task cancellation does not cause the underlying request to cancel as it does with an ordinary URLSessionTask.
Furthermore there doesn't appear to be any other mechanism to cancel this upload.
Expected Behavior
If S3Client.putObject(input:) is called within an asynchronous Task and that task is cancelled, the upload should also be cancelled.
Current Behavior
If S3Client.putObject(input:) is called within an asynchronous Task and that task is cancelled, the upload completes.
Reproduction Steps
Running the following code:
let input: PutObjectInput = // ... some valid object
let task = Task {
do {
print("\(Date.now): upload will start")
let response = try await s3.putObject(input: input)
print("\(Date.now): upload complete")
} catch {
print("\(Date.now): upload cancelled")
}
}
try await Task.sleep(for: .seconds(1))
print("\(Date.now): will cancel task")
task.cancel()
print("\(Date.now): did cancel task")
print("\(Date.now): waiting")
try await Task.sleep(for: .seconds(60))Prints:
2025-07-03 15:37:44 +0000: upload will start
2025-07-03 15:37:45 +0000: will cancel task
2025-07-03 15:37:45 +0000: did cancel task
2025-07-03 15:37:45 +0000: waiting
2025-07-03 15:37:54 +0000: upload complete
Possible Solution
No response
Additional Information/Context
Note, I asked about cancellation in this discussion but now think this is a bug.
AWS SWIFT SDK version used
1.3.43
Compiler and Version used
Xcode 16.3
Operating System and version
iOS 18.5
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.