Amazon IOS S3 SDK: message sent to an exempted instance

I get the following error:

*** -[S3PutObjectOperation_Internal respondsToSelector:]: message sent to deallocated instance 0x43c18fd0 

I don't understand the stack trace from the Zombies inspector very well, I'm not sure if this tells me everything I can fix:

 # Address Category Event Type RefCt Timestamp Size Responsible Library Responsible Caller 0 0xc071f60 S3PutObjectOperation_Internal Malloc 1 00:14.903.021 48 MyApp -[S3TransferManager upload:] 1 0xc071f60 S3PutObjectOperation_Internal Retain 2 00:14.903.032 0 Foundation ____addOperations_block_invoke_0 2 0xc071f60 S3PutObjectOperation_Internal Release 1 00:14.903.036 0 MyApp -[S3TransferManager upload:] 3 0xc071f60 S3PutObjectOperation_Internal Retain 2 00:14.904.154 0 libsystem_sim_blocks.dylib _Block_object_assign 4 0xc071f60 S3PutObjectOperation_Internal Retain 3 00:14.904.163 0 libsystem_sim_blocks.dylib _Block_object_assign 5 0xc071f60 S3PutObjectOperation_Internal Release 2 00:14.904.164 0 Foundation __destroy_helper_block_474 6 0xc071f60 S3PutObjectOperation_Internal Retain 3 00:14.906.549 0 MyApp -[S3PutObjectOperation_Internal start] 7 0xc071f60 S3PutObjectOperation_Internal Release 2 00:14.906.554 0 MyApp -[S3PutObjectOperation_Internal start] 8 0xc071f60 S3PutObjectOperation_Internal Release 1 00:14.907.624 0 MyApp __destroy_helper_block_ 9 0xc071f60 S3PutObjectOperation_Internal Retain 2 00:15.243.299 0 MyApp -[S3PutObjectOperation_Internal finish] 10 0xc071f60 S3PutObjectOperation_Internal Retain 3 00:15.243.302 0 MyApp -[S3PutObjectOperation_Internal finish] 11 0xc071f60 S3PutObjectOperation_Internal Release 2 00:15.243.307 0 MyApp -[S3PutObjectOperation_Internal finish] 12 0xc071f60 S3PutObjectOperation_Internal Release 1 00:15.243.330 0 MyApp -[S3PutObjectOperation_Internal finish] 13 0xc071f60 S3PutObjectOperation_Internal Release 0 00:15.244.420 0 Foundation __release_object_op 14 0xc071f60 S3PutObjectOperation_Internal Zombie -1 00:15.386.107 0 MyApp -[S3Response connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:] 

This error occurs when the application uploads photos. The Photo object uses and implements the following methods:

 -(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { NSLog(@"didSendData called: %d - %d / %d", bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); self.transferProgress += bytesWritten; float p = (float) self.transferProgress / self.uploadSize; self.uploadProgress = [NSNumber numberWithFloat:p]; } -(void)request:(AmazonServiceRequest *)request didCompleteWithResponse:(AmazonServiceResponse *)response { NSLog(@"didCompleteWithResponse called."); } -(void)request:(AmazonServiceRequest *)request didFailWithError:(NSError *)error { NSLog(@"didFailWithError called: %@", error); } 

As far as I know, this is the only moment in the application in which the S3 request talks to any other objects / instances. Any idea what causes this error?

+4
source share
1 answer

I think this is a bug in the AWS SDK. I'm not sure where exactly the error is, but it is caused by requests if the response was an exception to the service (and, perhaps, only in combination with S3TransferManager).

I did not want to disable all retries, so I fixed this without forcing retries to throw exceptions. You can do this using a subclass of AmazonS3Client, where you override one of these methods:

 - (BOOL)shouldRetry:(AmazonServiceResponse *)response exception:(NSException *)exception { // There is some kind of bug that is triggered on request retries when S3 requests // return an explicit service exception (eg, auth token expired). In these cases // we force no retry to avoid the bug. NSException *exceptionHolder = response.exception; if(exceptionHolder == nil) { exceptionHolder = exception; } if([exceptionHolder isKindOfClass:[AmazonServiceException class]]) { return NO; } return [super shouldRetry:response exception:exception]; } 
+1
source

Source: https://habr.com/ru/post/1483038/


All Articles