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

There is no way to cancel a request (download or upload) if internet disable #1529

Closed
harshadmehmood opened this issue May 28, 2024 · 6 comments
Assignees
Labels
bug This issue is a bug.

Comments

@harshadmehmood
Copy link

Describe the bug

While trying to download a file using getObject method, there is no way to detect if there is any error in network connection

Expected Behavior

Method should return some sort of error in catch block

Current Behavior

No fallback in catch when internet disconnected, no way to cancel the request

Reproduction Steps

let input = GetObjectInput( bucket: bucket, key: key ) do { let output = try await client.getObject(input: input) } catch { print("error while download : \(error)") }

Possible Solution

No response

Additional Information/Context

No response

AWS SWIFT SDK version used

0.23.0

Compiler and Version used

xcode :Version 15.4 (15F31d), swift: version 5

Operating System and version

MacOS Sonoma 14.4.1 (23E224)

@harshadmehmood harshadmehmood added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 28, 2024
@dayaffe
Copy link
Collaborator

dayaffe commented May 28, 2024

Hello! Thank you for creating this issue! We will look into this and get back to you once we know more.

@sichanyoo
Copy link
Contributor

@harshadmehmood
Hello, thank you for submitting the issue.

After doing a quick test-run, I've confirmed that this is no longer an issue in the latest SDK version, v0.44.0. With each new minor release, we routinely fix bugs; this may have been one of those that have been addressed.

Instead of v0.23.0, please try using the latest version.

@harshadmehmood
Copy link
Author

harshadmehmood commented May 29, 2024

@sichanyoo many thanks indeed, issue fixed, but i got another one after updating SDK, its related to the output i get when calling getObject method, the scenario is,

  • send the request to download an item
  • disconnect internet
  • got an output with but its incomplete
  • Didn't got any error in 'catch'

@harshadmehmood
Copy link
Author

here is console log, in this case dont catch error at all.

2024-05-29T18:30:30+0500 info S3Client : [Logging] Request: GET https:443 Path: /xyz/asdf.png x-amz-content-sha256: xxxxxx, Authorization: AWS4-HMAC-SHA256 Credential=yyyyy/us-east-2/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=iiiii, X-Amz-Date: 20240529T133030Z, User-Agent: aws-sdk-swift/1.0 ua/2.0 api/s3#1.0 os/macos#14.4.1 lang/swift#5.10 cfg/retry-mode#legacy, Host: dummy.s3.us-east-2.amazonaws.com Optional([ClientRuntime.SDKURLQueryItem(name: "x-id", value: Optional("GetObject"))]) 2024-05-29T18:30:30+0500 info URLSessionHTTPClient : [Logging] start URLRequest(https://uiuiuiui.png?x-id=GetObject) called 2024-05-29T18:30:30+0500 info URLSessionHTTPClient : [Logging] urlSession(_:dataTask:didReceive response:) called 2024-05-29T18:30:30+0500 info URLSessionHTTPClient : [Logging] urlSession(_:dataTask:didReceive data:) called (1541 bytes) 2024-05-29T18:30:30+0500 info S3Client : [Logging] User requested checksum validation, but the response headers did not contain any valid checksums output.contentLength - Optional(866484) output.contentRange - nil Device verification failed for transaction nw_proto_tcp_route_init [C1.1.1:3] no mtu received Connection 1: encountered error(1:53) nw_endpoint_flow_fillout_data_transfer_snapshot copy_info() returned NULL nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint Task <6285043F-C46B-4A7F-8661-46D5A6860C1D>.<2> HTTP load failed, 711/1938 bytes (error code: -1005 [1:53]) Task <6285043F-C46B-4A7F-8661-46D5A6860C1D>.<2> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x600002af6940 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600000722da0 [0x208aa88c0]>{length = 16, capacity = 16, bytes = 0x100201bb34db5ce20000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <jkjkjkjkjk>.<2>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <6285043F-C46B-4A7F-8661-46D5A6860C1D>.<2>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://uiuiuiuiui.png?x-id=GetObject, NSErrorFailingURLKey=https://uiuiuiui.png?x-id=GetObject, _kCFStreamErrorDomainKey=1} 2024-05-29T18:30:57+0500 info URLSessionHTTPClient : [Logging] urlSession(_:task:didCompleteWithError:) failed. Error: The network connection was lost.

@sichanyoo
Copy link
Contributor

Hmm I see. Thank you for the follow-up, we'll look into this further.

@sichanyoo sichanyoo self-assigned this May 29, 2024
@jbelkins jbelkins self-assigned this May 30, 2024
@jbelkins jbelkins removed the needs-triage This issue or PR still needs to be triaged. label May 30, 2024
@jbelkins
Copy link
Contributor

A fix for this issue will be included in our next release.
Related PR: smithy-lang/smithy-swift#743

The stream used to receive response data should now throw with any connection error received after the initial HTTP response is received, but while the body is still streaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants