aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 883 forks source link

Request timeouts/SignatureDoesNotMatch errors/weird console logs when starting multiple uploads at the same time #602

Closed ilijapuaca closed 6 years ago

ilijapuaca commented 7 years ago

iOS Version: 10.2 AWS SDK Version: 2.5.0 (not using 2.5.1 due to #592)

I started incorporating AWSS3 SDK into my own app, and ran into some issues. In order to make sure problems were not related to my app code, I created a super simple app that consists of code from the documentation:

AppDelegate.swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Initialize AWSS3TransferManager that we'll use for uploading files, with Cognito as credential provider
        let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
        let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialsProvider)
        AWSServiceManager.default().defaultServiceConfiguration = configuration

        return true
    }

ViewController.swift

import UIKit
import AWSS3

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        testParallelUpload()
    }

    private func testParallelUpload() {
        for index in 1...4 {
            if let filePath = Bundle.main.url(forResource: "TestFile\(index)", withExtension: "jpg") {
                uploadFile(at: filePath)
            }
        }
    }

    private func uploadFile(at path: URL) {
        let transferManager = AWSS3TransferManager.default()

        let uploadRequest = AWSS3TransferManagerUploadRequest()!
        uploadRequest.bucket = "bucket"
        uploadRequest.key = "S3TestSample/" + path.lastPathComponent
        uploadRequest.body = path

        transferManager.upload(uploadRequest).continueWith(executor: AWSExecutor.mainThread(), block: { (task:AWSTask<AnyObject>) -> Any? in
            if let error = task.error as? NSError {
                if error.domain == AWSS3TransferManagerErrorDomain, let code = AWSS3TransferManagerErrorType(rawValue: error.code) {
                    switch code {
                    case .cancelled, .paused:
                        break
                    default:
                        print("Error uploading: \(uploadRequest.key) Error: \(error)")
                    }
                } else {
                    print("Error uploading: \(uploadRequest.key) Error: \(error)")
                }
                return nil
            }

            print("Upload complete for: \(uploadRequest.key)")
            return nil
        })
    }

}

As you can see, it is pretty simple. It tries starting the uploads for 4 sample files that are part of the app bundle. The same thing happens with 2 files too, and some of the errors (SignatureDoesNotMatch) pop up for a single file sometimes.

Here's the log. I filtered and replaced any user/session/secret key related strings (hopefully) in order to avoid potentially compromising any credentials.

AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    "Content-Type" = "application/x-amz-json-1.1";
    Host = "cognito-identity.us-east-1.amazonaws.com";
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US";
    "X-Amz-Date" = 20170224T154009Z;
    "X-Amz-Target" = "AWSCognitoIdentityService.GetId";
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:555 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request body:
{"IdentityPoolId":"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = "keep-alive";
    "Content-Length" = 63;
    "Content-Type" = "application/x-amz-json-1.1";
    Date = "Fri, 24 Feb 2017 15:40:11 GMT";
    "x-amzn-RequestId" = "871d5e8c-faa7-11e6-ae6f-93ccad060676";
}
AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:63 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
{"IdentityId":"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    "Content-Type" = "application/x-amz-json-1.1";
    Host = "cognito-identity.us-east-1.amazonaws.com";
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US";
    "X-Amz-Date" = 20170224T154010Z;
    "X-Amz-Target" = "AWSCognitoIdentityService.GetCredentialsForIdentity";
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:555 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request body:
{"IdentityId":"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
OSStatus error: [-25299] Security error has occurred.
OSStatus error: [-25299] Security error has occurred.
OSStatus error: [-25299] Security error has occurred.
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = "keep-alive";
    "Content-Length" = 1612;
    "Content-Type" = "application/x-amz-json-1.1";
    Date = "Fri, 24 Feb 2017 15:40:11 GMT";
    "x-amzn-RequestId" = "879fd4cf-faa7-11e6-965e-2f4586b5f594";
}
AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:63 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
{"Credentials":{"AccessKeyId":"ASIAJHXCX3YX3NDITL5Q","Expiration":1.487954412E9,"SecretKey":"xxx","SessionToken":"xxx"},"IdentityId":"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=ca7f5d0035bc8c446ec4405f690acd833fa8b6ad7516385582cdfd6a76c1fcae";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154009Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 906227;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=a20b0bfb8558f0a19c97b02e6ebe1cad76c40886dbd7890135d81f4d7d773f64";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154009Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 642040;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=4f9b066f037a322288d339080882518a19f94b4b7aa68df458a3a8c4b0a0999d";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154009Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 823211;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=8170ee6fa6e38e2f43b86823f3e3c4daf999357abd35e76405bba97623e29b47";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154009Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 756982;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = close;
    "Content-Type" = "application/xml";
    Date = "Fri, 24 Feb 2017 15:40:14 GMT";
    Server = AmazonS3;
    "Transfer-Encoding" = Identity;
    "x-amz-id-2" = "CA3ODaITbPG7p8o5skTySlzKXvVw493VKmkx3XdC+cvtkIdOKzyCB+ZYwXApGHM183dSpGir0x0=";
    "x-amz-request-id" = 2A721C50CB32E62C;
}
[] nw_endpoint_flow_prepare_output_frames [4.1 52.216.224.219:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:240 | -[AWSXMLResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>ASIAJHXCX3YX3NDITL5Q</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256-PAYLOAD
20170224T154009Z
20170224/us-east-1/s3/aws4_request
a20b0bfb8558f0a19c97b02e6ebe1cad76c40886dbd7890135d81f4d7d773f64
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
56662d4e289e4a14a56ce3f3c27748f010042b3a767663e29a5841b585066e41</StringToSign><SignatureProvided>eaee29706b9152c05c48391c2a4446ff5ac5def8597f51759095413b4b43a021</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44 0a 32 30 31 37 30 32 32 34 54 31 35 34 30 30 39 5a 0a 32 30 31 37 30 32 32 34 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 61 32 30 62 30 62 66 62 38 35 35 38 66 30 61 31 39 63 39 37 62 30 32 65 36 65 62 65 31 63 61 64 37 36 63 34 30 38 38 36 64 62 64 37 38 39 30 31 33 35 64 38 31 66 34 64 37 64 37 37 33 66 36 34 0a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35 0a 35 36 36 36 32 64 34 65 32 38 39 65 34 61 31 34 61 35 36 63 65 33 66 33 63 32 37 37 34 38 66 30 31 30 30 34 32 62 33 61 37 36 37 36 36 33 65 32 39 61 35 38 34 31 62 35 38 35 30 36 36 65 34 31</StringToSignBytes><CanonicalRequest>PUT
/im-demo/S3TestSample/TestFile4.jpg

content-encoding:aws-chunked
content-type:binary/octet-stream
host:s3.amazonaws.com
transfer-encoding:Chunked
user-agent:aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager
x-amz-content-sha256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD
x-amz-date:20170224T154009Z
x-amz-decoded-content-length:642040
x-amz-security-token:xxx

content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token
STREAMING-AWS4-HMAC-SHA256-PAYLOAD</CanonicalRequest><CanonicalRequestBytes>50 55 54 0a 2f 69 6d 2d 64 65 6d 6f 2f 53 33 54 65 73 74 53 61 6d 70 6c 65 2f 54 65 73 74 46 69 6c 65 34 2e 6a 70 67 0a 0a 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3a 61 77 73 2d 63 68 75 6e 6b 65 64 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 62 69 6e 61 72 79 2f 6f 63 74 65 74 2d 73 74 72 65 61 6d 0a 68 6f 73 74 3a 73 33 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 74 72 61 6e 73 66 65 72 2d 65 6e 63 6f 64 69 6e 67 3a 43 68 75 6e 6b 65 64 0a 75 73 65 72 2d 61 67 65 6e 74 3a 61 77 73 2d 73 64 6b 2d 69 4f 53 2f 32 2e 35 2e 30 20 69 4f 53 2f 31 30 2e 32 20 65 6e 5f 55 53 20 74 72 61 6e 73 66 65 72 2d 6d 61 6e 61 67 65 72 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 53 54 52 45 41 4d 49 4e 47 2d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 31 37 30 32 32 34 54 31 35 34 30 30 39 5a 0a 78 2d 61 6d 7a 2d 64 65 63 6f 64 65 64 2d 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3a 36 34 32 30 34 30 0a 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3a 41 67 6f 47 62 33 4a 70 5a 32 6c 75 45 46 73 61 43 58 56 7a 4c 57 56 68 63 33 51 74 4d 53 4b 41 41 67 7a 75 45 42 79 4b 57 61 34 55 4d 75 4f 48 30 46 34 74 49 63 64 53 68 6f 7a 63 34 5a 45 70 47 35 76 4b 41 74 54 75 72 72 37 6d 35 71 62 35 38 7a 38 36 4d 62 54 46 49 47 39 48 59 33 6a 59 39 33 52 65 44 68 79 73 79 61 62 45 77 4f 51 79 4f 62 70 31 6d 55 2b 41 31 79 36 62 56 6e 73 33 37 4f 58 50 37 57 75 2b 66 61 46 6e 2b 73 4c 76 46 31 58 64 74 52 47 62 2b 67 32 62 7a 6d 6c 72 58 56 30 2b 36 41 68 72 31 77 52 68 47 6f 59 69 78 61 72 35 4b 6e 55 62 68 63 57 35 51 79 65 6d 53 70 48 66 6b 43 49 5a 7a 47 53 51 51 49 2b 42 6c 4b 2f 46 59 6a 4b 59 76 46 52 76 50 41 31 30 73 7a 76 58 57 51 67 2f 59 4f 45 79 4d 47 34 50 50 46 2f 52 4e 37 6e 4b 53 43 4f 35 53 55 4a 74 78 6c 76 43 43 76 71 46 44 71 56 72 42 77 62 6f 4f 67 76 39 50 76 46 4b 35 6f 64 65 32 75 55 71 72 6f 45 57 59 32 6f 49 71 67 42 33 34 76 67 4a 67 46 4a 46 6b 73 5a 6b 41 76 65 68 75 46 50 6f 58 45 74 2f 4b 44 68 48 68 6d 6e 37 30 59 6b 36 4a 62 2b 32 61 4b 69 67 78 37 53 6e 65 76 6c 7a 76 47 70 64 2f 6a 4b 6a 58 2b 6a 57 6b 68 72 6f 55 30 6b 69 5a 55 34 71 39 41 55 49 38 66 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 41 52 41 41 47 67 77 33 4f 54 6b 31 4d 54 4d 7a 4e 6a 49 34 4d 54 45 69 44 47 70 6e 6b 31 49 75 67 36 30 4e 56 74 36 36 42 53 72 49 42 55 65 48 79 73 69 4c 37 34 6c 6a 4c 44 6f 4e 36 2b 4c 4b 6c 58 6b 32 6c 4c 6f 66 4b 53 2b 6f 79 2b 77 6d 73 48 4c 4f 56 67 31 30 4f 4c 34 6d 71 62 50 41 76 64 77 43 48 72 72 45 42 32 6b 32 74 43 47 39 4c 58 39 59 49 43 4c 6c 73 44 36 43 2b 61 37 2b 72 62 69 55 76 6c 58 6b 67 65 32 6b 2f 73 59 41 34 4b 6f 48 4a 6d 36 78 79 67 75 78 4d 51 59 6d 33 36 44 34 57 2b 43 5a 48 41 6f 77 5a 49 46 65 69 72 4b 47 43 59 49 72 41 42 64 46 37 45 41 4c 73 42 70 53 30 34 43 70 48 38 38 6d 34 75 77 4e 42 30 75 2b 39 68 51 4a 69 33 74 76 36 79 48 33 47 51 34 37 5a 69 51 33 65 6e 4e 39 36 76 4a 6b 62 61 36 39 51 58 61 6e 6b 47 37 73 54 61 69 38 71 41 31 4d 72 6b 79 6f 4f 69 47 52 71 4f 31 4a 74 65 79 71 74 38 55 34 31 71 53 70 34 44 53 65 78 73 65 7a 4b 48 43 78 79 58 34 33 65 36 44 43 48 69 71 6b 70 65 74 72 67 45 74 77 6b 6f 63 39 34 63 48 74 32 50 68 31 61 4d 41 78 2b 65 51 72 55 6a 72 51 7a 66 6e 72 48 42 31 78 6e 63 55 47 30 46 66 69 52 4b 49 42 6c 6a 48 43 42 59 73 32 51 4c 67 55 52 34 4d 70 51 4d 2f 6b 6b 67 66 4e 4e 36 55 34 50 4f 6f 38 61 63 37 67 79 67 55 4e 48 4e 41 73 54 36 59 79 36 51 6f 76 5a 6a 43 38 4a 6b 65 7a 56 37 35 4c 57 6d 48 64 57 69 58 36 7a 72 4e 56 38 6f 71 73 74 68 58 38 77 42 4f 63 37 4b 6a 45 73 42 57 52 6d 46 39 32 52 32 48 2b 6b 52 31 6b 51 76 74 61 76 52 73 4b 77 45 31 42 51 5a 33 57 66 56 71 73 35 46 4a 51 31 4f 46 73 5a 33 65 59 44 34 79 51 63 36 71 79 6c 68 75 4f 51 72 77 70 76 41 7a 73 44 53 45 41 38 72 4f 51 64 71 4a 6a 6b 37 4c 4a 49 30 39 48 4f 4b 65 38 6d 50 58 68 75 52 61 50 41 48 4c 48 53 62 38 56 73 68 6e 2f 62 38 5a 4d 6a 50 4a 51 47 46 32 54 73 46 64 66 62 78 4c 4d 42 5a 42 78 39 45 45 4d 64 33 62 49 34 4b 52 42 4e 33 41 77 41 31 71 5a 56 38 4b 74 64 4f 6f 62 50 4b 59 36 57 47 4a 4f 76 53 65 36 64 73 4a 77 7a 54 54 50 5a 67 5a 32 30 70 46 6b 34 5a 61 74 63 52 43 6d 38 45 6b 53 31 4f 33 6a 64 49 71 75 37 4d 75 63 78 72 6d 46 59 39 54 57 69 6f 30 6b 37 69 6e 70 78 34 36 51 65 47 6a 59 38 6f 62 32 49 65 4b 45 34 4c 57 4b 36 36 51 68 75 46 74 34 47 4f 78 49 43 6c 66 4d 73 58 48 7a 61 58 67 74 75 59 57 75 56 30 61 52 52 41 47 49 68 7a 56 48 4d 73 63 37 32 61 6f 2f 42 37 51 73 4b 35 4f 46 4f 35 5a 77 47 62 6c 52 56 61 41 31 52 45 35 50 50 52 6b 61 72 59 77 66 4b 47 67 34 77 59 45 65 67 5a 46 53 4d 77 56 66 74 45 61 55 37 54 6e 52 4d 35 6d 59 55 71 57 5a 4d 4a 78 37 7a 6f 43 46 71 31 43 4a 48 4c 57 6a 77 4b 7a 37 30 32 52 75 52 45 5a 46 68 4f 6f 45 5a 51 6b 68 52 6f 73 51 46 75 62 4b 74 6e 34 47 63 64 61 31 65 36 52 54 38 72 38 63 59 4a 35 48 6b 74 50 54 44 49 70 52 76 46 61 39 32 43 50 64 72 30 30 52 79 6c 64 4b 7a 65 6f 64 2f 43 2b 2b 77 71 79 79 4c 79 6d 48 57 53 6d 57 52 39 35 77 76 42 50 37 69 32 69 36 58 50 6f 65 39 78 31 65 63 51 55 33 51 65 79 55 4b 31 67 6b 70 74 58 66 71 50 47 36 53 64 65 49 47 36 41 30 30 59 67 4c 56 43 30 78 36 61 7a 4e 64 70 50 4f 72 73 61 77 30 33 63 77 33 4b 66 42 78 51 55 3d 0a 0a 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3b 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 74 72 61 6e 73 66 65 72 2d 65 6e 63 6f 64 69 6e 67 3b 75 73 65 72 2d 61 67 65 6e 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 3b 78 2d 61 6d 7a 2d 64 65 63 6f 64 65 64 2d 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3b 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 0a 53 54 52 45 41 4d 49 4e 47 2d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes><RequestId>2A721C50CB32E62C</RequestId><HostId>CA3ODaITbPG7p8o5skTySlzKXvVw493VKmkx3XdC+cvtkIdOKzyCB+ZYwXApGHM183dSpGir0x0=</HostId></Error>
[] nw_endpoint_handler_add_write_request [4.1 52.216.224.219:443 failed socket-flow (satisfied)] cannot accept write requests
[] nw_endpoint_handler_add_write_request [4.1 52.216.224.219:443 failed socket-flow (satisfied)] cannot accept write requests
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=4ee0d2990bce59db0613a145a0c266618fd224091efa90aadb994106f97c7e86";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154015Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 642040;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = close;
    "Content-Type" = "application/xml";
    Date = "Fri, 24 Feb 2017 15:40:14 GMT";
    Server = AmazonS3;
    "Transfer-Encoding" = Identity;
    "x-amz-id-2" = "vA9/ZF9Z3dklN6qVwowgaMrl5H1Tq70O2uTNEh09SQrY/79s13uvqOsAGt+2UhqCbf177xs9bEQ=";
    "x-amz-request-id" = 603479E86D1D04DE;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:240 | -[AWSXMLResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>ASIAJHXCX3YX3NDITL5Q</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256-PAYLOAD
20170224T154009Z
20170224/us-east-1/s3/aws4_request
4f9b066f037a322288d339080882518a19f94b4b7aa68df458a3a8c4b0a0999d
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
0435834bbd9c72df8f2e609abc99106057d6de379e9a73d97dd373735bf56403</StringToSign><SignatureProvided>66efd1146b4f33182e8908fe4f548a3fc73427793bc5b85edbb5edfe0eb0b914</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44 0a 32 30 31 37 30 32 32 34 54 31 35 34 30 30 39 5a 0a 32 30 31 37 30 32 32 34 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 34 66 39 62 30 36 36 66 30 33 37 61 33 32 32 32 38 38 64 33 33 39 30 38 30 38 38 32 35 31 38 61 31 39 66 39 34 62 34 62 37 61 61 36 38 64 66 34 35 38 61 33 61 38 63 34 62 30 61 30 39 39 39 64 0a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35 0a 30 34 33 35 38 33 34 62 62 64 39 63 37 32 64 66 38 66 32 65 36 30 39 61 62 63 39 39 31 30 36 30 35 37 64 36 64 65 33 37 39 65 39 61 37 33 64 39 37 64 64 33 37 33 37 33 35 62 66 35 36 34 30 33</StringToSignBytes><CanonicalRequest>PUT
/im-demo/S3TestSample/TestFile3.jpg

content-encoding:aws-chunked
content-type:binary/octet-stream
host:s3.amazonaws.com
transfer-encoding:Chunked
user-agent:aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager
x-amz-content-sha256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD
x-amz-date:20170224T154009Z
x-amz-decoded-content-length:823211
x-amz-security-token:xxx

content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token
STREAMING-AWS4-HMAC-SHA256-PAYLOAD</CanonicalRequest><CanonicalRequestBytes>50 55 54 0a 2f 69 6d 2d 64 65 6d 6f 2f 53 33 54 65 73 74 53 61 6d 70 6c 65 2f 54 65 73 74 46 69 6c 65 33 2e 6a 70 67 0a 0a 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3a 61 77 73 2d 63 68 75 6e 6b 65 64 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 62 69 6e 61 72 79 2f 6f 63 74 65 74 2d 73 74 72 65 61 6d 0a 68 6f 73 74 3a 73 33 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 74 72 61 6e 73 66 65 72 2d 65 6e 63 6f 64 69 6e 67 3a 43 68 75 6e 6b 65 64 0a 75 73 65 72 2d 61 67 65 6e 74 3a 61 77 73 2d 73 64 6b 2d 69 4f 53 2f 32 2e 35 2e 30 20 69 4f 53 2f 31 30 2e 32 20 65 6e 5f 55 53 20 74 72 61 6e 73 66 65 72 2d 6d 61 6e 61 67 65 72 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 53 54 52 45 41 4d 49 4e 47 2d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 31 37 30 32 32 34 54 31 35 34 30 30 39 5a 0a 78 2d 61 6d 7a 2d 64 65 63 6f 64 65 64 2d 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3a 38 32 33 32 31 31 0a 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3a 41 67 6f 47 62 33 4a 70 5a 32 6c 75 45 46 73 61 43 58 56 7a 4c 57 56 68 63 33 51 74 4d 53 4b 41 41 67 7a 75 45 42 79 4b 57 61 34 55 4d 75 4f 48 30 46 34 74 49 63 64 53 68 6f 7a 63 34 5a 45 70 47 35 76 4b 41 74 54 75 72 72 37 6d 35 71 62 35 38 7a 38 36 4d 62 54 46 49 47 39 48 59 33 6a 59 39 33 52 65 44 68 79 73 79 61 62 45 77 4f 51 79 4f 62 70 31 6d 55 2b 41 31 79 36 62 56 6e 73 33 37 4f 58 50 37 57 75 2b 66 61 46 6e 2b 73 4c 76 46 31 58 64 74 52 47 62 2b 67 32 62 7a 6d 6c 72 58 56 30 2b 36 41 68 72 31 77 52 68 47 6f 59 69 78 61 72 35 4b 6e 55 62 68 63 57 35 51 79 65 6d 53 70 48 66 6b 43 49 5a 7a 47 53 51 51 49 2b 42 6c 4b 2f 46 59 6a 4b 59 76 46 52 76 50 41 31 30 73 7a 76 58 57 51 67 2f 59 4f 45 79 4d 47 34 50 50 46 2f 52 4e 37 6e 4b 53 43 4f 35 53 55 4a 74 78 6c 76 43 43 76 71 46 44 71 56 72 42 77 62 6f 4f 67 76 39 50 76 46 4b 35 6f 64 65 32 75 55 71 72 6f 45 57 59 32 6f 49 71 67 42 33 34 76 67 4a 67 46 4a 46 6b 73 5a 6b 41 76 65 68 75 46 50 6f 58 45 74 2f 4b 44 68 48 68 6d 6e 37 30 59 6b 36 4a 62 2b 32 61 4b 69 67 78 37 53 6e 65 76 6c 7a 76 47 70 64 2f 6a 4b 6a 58 2b 6a 57 6b 68 72 6f 55 30 6b 69 5a 55 34 71 39 41 55 49 38 66 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 41 52 41 41 47 67 77 33 4f 54 6b 31 4d 54 4d 7a 4e 6a 49 34 4d 54 45 69 44 47 70 6e 6b 31 49 75 67 36 30 4e 56 74 36 36 42 53 72 49 42 55 65 48 79 73 69 4c 37 34 6c 6a 4c 44 6f 4e 36 2b 4c 4b 6c 58 6b 32 6c 4c 6f 66 4b 53 2b 6f 79 2b 77 6d 73 48 4c 4f 56 67 31 30 4f 4c 34 6d 71 62 50 41 76 64 77 43 48 72 72 45 42 32 6b 32 74 43 47 39 4c 58 39 59 49 43 4c 6c 73 44 36 43 2b 61 37 2b 72 62 69 55 76 6c 58 6b 67 65 32 6b 2f 73 59 41 34 4b 6f 48 4a 6d 36 78 79 67 75 78 4d 51 59 6d 33 36 44 34 57 2b 43 5a 48 41 6f 77 5a 49 46 65 69 72 4b 47 43 59 49 72 41 42 64 46 37 45 41 4c 73 42 70 53 30 34 43 70 48 38 38 6d 34 75 77 4e 42 30 75 2b 39 68 51 4a 69 33 74 76 36 79 48 33 47 51 34 37 5a 69 51 33 65 6e 4e 39 36 76 4a 6b 62 61 36 39 51 58 61 6e 6b 47 37 73 54 61 69 38 71 41 31 4d 72 6b 79 6f 4f 69 47 52 71 4f 31 4a 74 65 79 71 74 38 55 34 31 71 53 70 34 44 53 65 78 73 65 7a 4b 48 43 78 79 58 34 33 65 36 44 43 48 69 71 6b 70 65 74 72 67 45 74 77 6b 6f 63 39 34 63 48 74 32 50 68 31 61 4d 41 78 2b 65 51 72 55 6a 72 51 7a 66 6e 72 48 42 31 78 6e 63 55 47 30 46 66 69 52 4b 49 42 6c 6a 48 43 42 59 73 32 51 4c 67 55 52 34 4d 70 51 4d 2f 6b 6b 67 66 4e 4e 36 55 34 50 4f 6f 38 61 63 37 67 79 67 55 4e 48 4e 41 73 54 36 59 79 36 51 6f 76 5a 6a 43 38 4a 6b 65 7a 56 37 35 4c 57 6d 48 64 57 69 58 36 7a 72 4e 56 38 6f 71 73 74 68 58 38 77 42 4f 63 37 4b 6a 45 73 42 57 52 6d 46 39 32 52 32 48 2b 6b 52 31 6b 51 76 74 61 76 52 73 4b 77 45 31 42 51 5a 33 57 66 56 71 73 35 46 4a 51 31 4f 46 73 5a 33 65 59 44 34 79 51 63 36 71 79 6c 68 75 4f 51 72 77 70 76 41 7a 73 44 53 45 41 38 72 4f 51 64 71 4a 6a 6b 37 4c 4a 49 30 39 48 4f 4b 65 38 6d 50 58 68 75 52 61 50 41 48 4c 48 53 62 38 56 73 68 6e 2f 62 38 5a 4d 6a 50 4a 51 47 46 32 54 73 46 64 66 62 78 4c 4d 42 5a 42 78 39 45 45 4d 64 33 62 49 34 4b 52 42 4e 33 41 77 41 31 71 5a 56 38 4b 74 64 4f 6f 62 50 4b 59 36 57 47 4a 4f 76 53 65 36 64 73 4a 77 7a 54 54 50 5a 67 5a 32 30 70 46 6b 34 5a 61 74 63 52 43 6d 38 45 6b 53 31 4f 33 6a 64 49 71 75 37 4d 75 63 78 72 6d 46 59 39 54 57 69 6f 30 6b 37 69 6e 70 78 34 36 51 65 47 6a 59 38 6f 62 32 49 65 4b 45 34 4c 57 4b 36 36 51 68 75 46 74 34 47 4f 78 49 43 6c 66 4d 73 58 48 7a 61 58 67 74 75 59 57 75 56 30 61 52 52 41 47 49 68 7a 56 48 4d 73 63 37 32 61 6f 2f 42 37 51 73 4b 35 4f 46 4f 35 5a 77 47 62 6c 52 56 61 41 31 52 45 35 50 50 52 6b 61 72 59 77 66 4b 47 67 34 77 59 45 65 67 5a 46 53 4d 77 56 66 74 45 61 55 37 54 6e 52 4d 35 6d 59 55 71 57 5a 4d 4a 78 37 7a 6f 43 46 71 31 43 4a 48 4c 57 6a 77 4b 7a 37 30 32 52 75 52 45 5a 46 68 4f 6f 45 5a 51 6b 68 52 6f 73 51 46 75 62 4b 74 6e 34 47 63 64 61 31 65 36 52 54 38 72 38 63 59 4a 35 48 6b 74 50 54 44 49 70 52 76 46 61 39 32 43 50 64 72 30 30 52 79 6c 64 4b 7a 65 6f 64 2f 43 2b 2b 77 71 79 79 4c 79 6d 48 57 53 6d 57 52 39 35 77 76 42 50 37 69 32 69 36 58 50 6f 65 39 78 31 65 63 51 55 33 51 65 79 55 4b 31 67 6b 70 74 58 66 71 50 47 36 53 64 65 49 47 36 41 30 30 59 67 4c 56 43 30 78 36 61 7a 4e 64 70 50 4f 72 73 61 77 30 33 63 77 33 4b 66 42 78 51 55 3d 0a 0a 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3b 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 74 72 61 6e 73 66 65 72 2d 65 6e 63 6f 64 69 6e 67 3b 75 73 65 72 2d 61 67 65 6e 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 3b 78 2d 61 6d 7a 2d 64 65 63 6f 64 65 64 2d 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3b 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 0a 53 54 52 45 41 4d 49 4e 47 2d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes><RequestId>603479E86D1D04DE</RequestId><HostId>vA9/ZF9Z3dklN6qVwowgaMrl5H1Tq70O2uTNEh09SQrY/79s13uvqOsAGt+2UhqCbf177xs9bEQ=</HostId></Error>
[] nw_endpoint_flow_prepare_output_frames [6.1 52.216.224.219:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
[] nw_endpoint_handler_add_write_request [6.1 52.216.224.219:443 failed socket-flow (satisfied)] cannot accept write requests
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=02fa46872c5ab2a9af478697a33fe48e47c7b81de69c77d475a8b5589034f1d6";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154015Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 823211;
}
[] nw_endpoint_flow_prepare_output_frames [3.1 52.216.17.163:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
[] nw_endpoint_handler_add_write_request [3.1 52.216.17.163:443 failed socket-flow (satisfied)] cannot accept write requests
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    "Content-Length" = 0;
    Date = "Fri, 24 Feb 2017 15:40:17 GMT";
    Etag = "\"3f2b3fb62c451c49221a43a7dd208281\"";
    Server = AmazonS3;
    "x-amz-id-2" = "Ue9VxjPgQGDAFWORlnhlFkrvZ1mMauPf0YtVg8mPGQLJW36trLxxcqtZOy0aocC1DGQrEPWowgM=";
    "x-amz-request-id" = C125D4529F4FFC80;
}
Upload complete for: Optional("S3TestSample/TestFile4.jpg")
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    "Content-Length" = 0;
    Date = "Fri, 24 Feb 2017 15:40:17 GMT";
    Etag = "\"b9ec4f765534795cbfc17e1df6033d2a\"";
    Server = AmazonS3;
    "x-amz-id-2" = "zV+GBMMmiHJTXzJmgH/PhkOrcK2Z0C5Vocw+KsFjhMh5ba/mZIrLa3SOYUBZtBIdZ0053uEbiwg=";
    "x-amz-request-id" = 6E5C4865A94D0075;
}
Upload complete for: Optional("S3TestSample/TestFile3.jpg")
AWSiOSSDK v2.5.0 [Error] AWSURLSessionManager.m line:212 | -[AWSURLSessionManager URLSession:task:didCompleteWithError:] | Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x6180002433c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile2.jpg, NSErrorFailingURLKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile2.jpg, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = close;
    "Content-Type" = "application/xml";
    Date = "Fri, 24 Feb 2017 15:40:14 GMT";
    Server = AmazonS3;
    "Transfer-Encoding" = Identity;
    "x-amz-id-2" = "Fri3fYRyYLBMnOE4Og1C/vEzkZSgeN6MKj56FwhrHU1KaqmNQBtNnM5T+X6y+ulpEZGmArUQ9yU=";
    "x-amz-request-id" = 454BE3A4F84EE8B2;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=5367e01e6b57c0f7117c1890d58965229489d958e675c5018b530126c67e4c85";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154115Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 756982;
}
AWSiOSSDK v2.5.0 [Error] AWSURLSessionManager.m line:212 | -[AWSURLSessionManager URLSession:task:didCompleteWithError:] | Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x610000246240 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile1.jpg, NSErrorFailingURLKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile1.jpg, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    Connection = close;
    "Content-Type" = "application/xml";
    Date = "Fri, 24 Feb 2017 15:40:14 GMT";
    Server = AmazonS3;
    "Transfer-Encoding" = Identity;
    "x-amz-id-2" = "4TokUEI8jQwN/9OWfHald/6TregGctAcNZNocyLL4Ju6dcdVm+qnWOIhZKpWeMlwe13m6gazHQQ=";
    "x-amz-request-id" = ECEE0E831EE12102;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:537 | -[AWSURLSessionManager printHTTPHeadersAndBodyForRequest:] | Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=ASIAJHXCX3YX3NDITL5Q/20170224/us-east-1/s3/aws4_request, SignedHeaders=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-security-token, Signature=b70dd8e55426c98036ba32d92a38070c2f66236538f7ac4f652e90f6a43ee28b";
    "Content-Encoding" = "aws-chunked";
    "Content-Type" = "binary/octet-stream";
    Host = "s3.amazonaws.com";
    "Transfer-Encoding" = Chunked;
    "User-Agent" = "aws-sdk-iOS/2.5.0 iOS/10.2 en_US transfer-manager";
    "X-Amz-Date" = 20170224T154116Z;
    "X-Amz-Security-Token" = "xxx";
    "x-amz-content-sha256" = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
    "x-amz-decoded-content-length" = 906227;
}
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    "Content-Length" = 0;
    Date = "Fri, 24 Feb 2017 15:41:18 GMT";
    Etag = "\"ae7d7e334bdce20bbc2be76fefb23e2f\"";
    Server = AmazonS3;
    "x-amz-id-2" = "MRhFddJJVeNTR1fCPWGcmKdQ7LfB0lIjUs+KTLchU8jwM2xx3MGzjEgN0S24kpImmiiQnDvKPsw=";
    "x-amz-request-id" = F765DA4EC23EBE95;
}
Upload complete for: Optional("S3TestSample/TestFile2.jpg")
AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
    "Content-Length" = 0;
    Date = "Fri, 24 Feb 2017 15:41:18 GMT";
    Etag = "\"e2fc12dcc5ae3eb3a2817f9e5bfbbd4e\"";
    Server = AmazonS3;
    "x-amz-id-2" = "IOyONsILEhrdL7aJnANLuaWgksOzFcf+ZpoaHQHvmilJtlDtPCVAFm9+nZb+ccrVkenKmpqD2LU=";
    "x-amz-request-id" = 56C52206949579E7;
}
Upload complete for: Optional("S3TestSample/TestFile1.jpg")

So a few things here:

When these get printed out, the upload request seems to become a zombie. It will time out after 60 seconds (Code=-1001 "The request timed out."), then retry again, after which it succeeds.

The last one is the most frustrating one as it practically delays the upload by 60 seconds (I could reduce the timeout, but it's not a solution).

I guess these can be broken up into multiple issues, but I think this is a good summary of all the things that go wrong for such a simple use case.

Please let me know if there's any additional info you need or whether I'm overlooking something.

karthiksaligrama commented 7 years ago

Have you enabled keychain access for your app?

ilijapuaca commented 7 years ago

You mean Keychain Sharing? I wasn't aware that it would be necessary.

Either way, enabled it just now and re-ran the sample code provided. Still getting all of the above. Did you try running this on your end?

ilijapuaca commented 7 years ago

Guys, anything?

karthiksaligrama commented 7 years ago

the debug statements below is not related (I think that newer version of xcode spews some socket logs)

[] nw_endpoint_flow_prepare_output_frames [6.1 52.216.224.219:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
[] nw_endpoint_handler_add_write_request [6.1 52.216.224.219:443 failed socket-flow (satisfied)] cannot accept write requests
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
ilijapuaca commented 7 years ago

The thing is, as I noted above, whenever these show up, the request times out after 60 seconds.

It is super frustrating as there is no way to detect this and retry, instead I have to wait for 60 seconds before and error gets thrown and retry, which delays the whole upload logic by a minute.

rohandubal commented 7 years ago

Hi @ilijapuaca Under what scenarios do you get the 60 second timeout? I used your code provided above and tried to reproduce the issue, but never I saw the 60 second timeout. The mismatch in signature should be fixed immediately in the retry.

Thanks, Rohan

ilijapuaca commented 7 years ago

I guess I should have included timestamps as well. For an example, exactly 60 seconds after system logs from above get printed out, this is the response I get (you can see it in the log I provided in the OP):

AWSiOSSDK v2.5.0 [Error] AWSURLSessionManager.m line:212 | -[AWSURLSessionManager URLSession:task:didCompleteWithError:] | Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x610000246240 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile1.jpg, NSErrorFailingURLKey=https://s3.amazonaws.com/im-demo/S3TestSample/TestFile1.jpg, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}

Is that not the case when you tried the code above? In that case I should test with more configurations as it happens every single time for me, both on simulator and device.

ilijapuaca commented 7 years ago

Still happens even with 2.5.2.

Did anyone try running the sample, am I really the only person with this issue?

vitor-moymer commented 7 years ago

I have that too and no success so far. I tried authenticated and not authenticated setups but with the same random problem

rohandubal commented 7 years ago

Hi @ilijapuaca

Did you try the iOS SDK TransferUtilitySample app provided here? https://github.com/awslabs/aws-sdk-ios-samples/tree/master/S3TransferUtility-Sample

Could you please mention if the issue occur with the above sample app as well?

Thanks, Rohan

ilijapuaca commented 7 years ago

The sample you provided is not completely relevant to this issue. It uploads a single image, and as the title of the issue suggests, problems seem to occur when there's multiple uploads being started at the same time.

The sample project also crashes on iOS10.0+ with following:

S3TransferUtilitySampleSwift[62125:1988075] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

After fixing that, I modified the code so that it uploads the same image multiple times.

I did not run into any issues. However, this sample uses different code from what is provided in the getting started section. It uploads raw data vs loading the file from given URL. I am not sure whether that changes anything, I didn't have enough time to modify it so that it uses the same API.

What I'm getting no feedback on is whether any of the devs managed to reproduce the issues I described above by running the simplest sample I provided entire code for in the OP?

I guess I'll try modifying my own code and use the API thats being used in the sample and see how that works out.

LathigaraBhavesh commented 7 years ago

@ilijapuaca, Did you find the issue regarding below error.

I am trying in with only one image to upload nothing else then also I am getting the same error.

So if you found this then please let me know.

Thanks

Marini83 commented 7 years ago

I am having the exact same issue:

AWSiOSSDK v2.4.9 [Verbose] AWSSignature.m line:660 | -[AWSS3ChunkedEncodingInputStream nextChunk] | stream read: 32677, chunk size: 32768 [] nw_endpoint_flow_prepare_output_frames [7.1 52.216.0.123:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed [] nw_endpoint_handler_add_write_request [7.1 52.216.0.123:443 failed socket-flow (satisfied)] cannot accept write requests [] tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument

Let's say it's a matter of having too many requests, how can I increase the chunk size? I modified the default chunk size from 32 1024 -91 to 128 1024 - 91 on AWSSignature.m and it still would upload 32768 chunk sizes....

Magrider commented 7 years ago

same issue with [] nw_endpoint_flow_prepare_output_frames [7.1 52.216.0.123:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed [] nw_endpoint_handler_add_write_request [7.1 52.216.0.123:443 failed socket-flow (satisfied)] cannot accept write requests [] tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument

any luck for this?

iyahimovitz commented 7 years ago

I'm seeing the same issue, anyone have any workaround for this? it happens about 40% of the time

rachelfong commented 7 years ago

I am currently trying to upload multiple images in parallel to an S3 bucket and still hitting the HTTP 403 SignatureDoesNotMatch error intermittently. Any luck solving this?

LathigaraBhavesh commented 7 years ago

I come to an end and working perfect I was using wrong "S3BucketName" and "AWSRegionType" so make sure these both should be correct.

There is no matter if you are getting these below three lines in your log. Ignore them. Because still I am getting these errors and working fine for me. Failed to use 1 frames, marking as failed cannot accept write requests Invalid argument

Enjoy Thanks.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.