amazon-archives/aws-sdk-ios-v1

S3PutObjectRequest stalls after sending some bytes

komocode opened this issue · 2 comments

I'm uploading an .mp4 file using S3PutObjectRequest and AmazonS3Client.

- (void)uploadWithData:(NSData *)data videoName:(NSString *)videoName
{
    S3PutObjectRequest *putRequest = [[S3PutObjectRequest alloc] initWithKey:[NSString stringWithFormat:@"videos/%@", videoName] inBucket:BUCKET_NAME];
    putRequest.data = data;
    putRequest.cannedACL = [S3CannedACL publicRead];
    putRequest.delegate = self;
    [_s3Client putObject:putRequest];
}    
-(void)request:(AmazonServiceRequest *)request didSendData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten totalBytesExpectedToWrite:(long long)totalBytesExpectedToWrite {
    NSLog(@"did send data totalbyteswritten: %lld totalBytesExpected: %lld", totalBytesWritten, totalBytesExpectedToWrite);
}
-(void)request:(AmazonServiceRequest *)request didCompleteWithResponse:(AmazonServiceResponse *)response {

    NSLog(@"did complete: %@", response);
}
-(void)request:(AmazonServiceRequest *)request didFailWithError:(NSError *)error {
    NSLog(@"did fail: %@", error);
}

Console logs show:


2012-11-02 02:47:04.216 divinenight[1835:907] did send data totalbyteswritten: 32768l totalBytesExpected: 1890610l

2012-11-02 02:47:04.218 divinenight[1835:907] did send data totalbyteswritten: 65536l totalBytesExpected: 1890610l

2012-11-02 02:47:04.220 divinenight[1835:907] did send data totalbyteswritten: 98304l totalBytesExpected: 1890610l

2012-11-02 02:47:04.221 divinenight[1835:907] did send data totalbyteswritten: 131072l totalBytesExpected: 1890610l

2012-11-02 02:47:04.303 divinenight[1835:907] did send data totalbyteswritten: 163840l totalBytesExpected: 1890610l

2012-11-02 02:49:28.726 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSErrorFailingURLStringKey = https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4

2012-11-02 02:49:28.731 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSErrorFailingURLKey = https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4

2012-11-02 02:49:28.733 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSLocalizedDescription = The Internet connection appears to be offline.

2012-11-02 02:49:28.735 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|234|UserInfo.NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94f9d0 {NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline.}

2012-11-02 02:49:28.740 divinenight[1835:907] S3Response.m|-[S3Response connection:didFailWithError:]|237|An error occured in the request: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94e140 {NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline., NSUnderlyingError=0x1f94f420 "The Internet connection appears to be offline."}

2012-11-02 02:49:28.742 divinenight[1835:907] did fail: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1f94e140 {NSErrorFailingURLStringKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSErrorFailingURLKey=https://macdivinenight-beta.s3.amazonaws.com/videos%2F6b8060ac94be73a8aaf9f950a2c96712-1351804738.mp4, NSLocalizedDescription=The Internet connection appears to be offline., NSUnderlyingError=0x1f94f420 "The Internet connection appears to be offline."}

Basic issue is: after uploading just a few bytes, the request hangs for a few minutes before finally timing out. I've tried a clean install of the app, rebooting the device, creating a new IAM key for s3 permissions (gave it full admin permissions), nothing seems to fix it. It is 100% reproducable.

Any help? Odd thing is that the bug suddenly appeared recently and I haven't changed the code one bit. It was working for several weeks up until couple of days ago when a client reported the issue. Using 1.7.0.

Are you issuing the put request on the endpoint where the bucket is located? http://stackoverflow.com/questions/15069772/aws-s3-upload-image-to-bucket-ios-app

Closing due to lack of response. If the endpoint change did not fix your issue, please feel free to reopen.