I have tested this with a 1.75 GB file and a 2.3 GB file. It seems to work correctly for the 1.75 GB file, but not for the 2.3 GB file.
In the 2.3 GB case, the contentLength gets changed to something negative. One possible hypothesis could be that 2.3 GB is larger than the size of a 32 bit signed int?
To Reproduce
Base case
Try uploading a file of size < 2.1 GB
use Fast App Termination and put app in background to simulate the app getting terminated by the system
re-open app
after a few minutes, the app correctly associates the upload and finishes
Steps to reproduce the behavior:
Try uploading a file of size > 2.1 GB
use Fast App Termination and put app in background to simulate the app getting terminated by the system
re-open app
after a few minutes, you can see onProgress callbacks, but the progress is always 0 and task.contentLength is negative
Eventually, the upload will fail with the following error
com.amazonaws.AWSS3TransferUtilityErrorDomain - 2: Error Domain=com.amazonaws.AWSS3TransferUtilityErrorDomain Code=2 "(null)" UserInfo={Message=Expected to send [-1962180493], but sent [2332786803] and there are no remaining parts. Failing transfer }
Observed Behavior
see above
Expected Behavior
my expected behavior is that the upload would restart more quickly than 3 minutes, or at least have some way to indicate to the app that it is restarting, but that bug is already filed here https://github.com/aws-amplify/aws-sdk-ios/issues/4580. I suspect if one were to terminate the app again while the restart is happening, this would incur more issues, but that's separate from this issue.
A clear and concise description of what you expected to happen.
Stack Trace
Please provide a stack trace if applicable e.g. a crash is occurring.
Code Snippet
I have generally followed the same instructions in the AutoResume sample app
Unique Configuration
If you are reporting an issue with a unique configuration or where configuration can make a difference in code execution (i.e. Cognito) please provide your configuration. Please make sure to obfuscate sensitive information from the configuration before posting.
Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
AWSTransferUtility
Screenshots
If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
SDK Version: 2.37.2
Dependency Manager: Cocoapods
Swift Version : Latest
Xcode Version: Latest
Device Information (please complete the following information):
Device: iPhone 14 Pro
iOS Version: 18
Specific to simulators: probably not
Additional context
Add any other context about the problem here like your specific use case.
Relevant Console Output
In some cases, it might be helpful to add any logs from your console that better help you tell the story of this issue. You can easily enable logging in your app by putting the following code in your app delegate.
Describe the bug
I am utilizing the behavior in the Swift TransferUtility documentation here https://docs.amplify.aws/gen1/swift/sdk/storage/transfer-utility/#managing-transfers-when-an-app-restarts
I have tested this with a 1.75 GB file and a 2.3 GB file. It seems to work correctly for the 1.75 GB file, but not for the 2.3 GB file.
In the 2.3 GB case, the contentLength gets changed to something negative. One possible hypothesis could be that 2.3 GB is larger than the size of a 32 bit signed int?
To Reproduce Base case
Steps to reproduce the behavior:
task.contentLength
is negativeObserved Behavior see above Expected Behavior
A clear and concise description of what you expected to happen.
Stack Trace Please provide a stack trace if applicable e.g. a crash is occurring.
I am logging to Datadog here
you can see here where after the app restarts, the contentLength changes
Note that the original content length was
2332786803
. the new content length is-1962180493
This is the value of the former as a signed intCode Snippet I have generally followed the same instructions in the AutoResume sample app
Unique Configuration If you are reporting an issue with a unique configuration or where configuration can make a difference in code execution (i.e. Cognito) please provide your configuration. Please make sure to obfuscate sensitive information from the configuration before posting.
Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
Screenshots If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context Add any other context about the problem here like your specific use case.
Relevant Console Output In some cases, it might be helpful to add any logs from your console that better help you tell the story of this issue. You can easily enable logging in your app by putting the following code in your app delegate.
Logs
Please logs in the code block below. (See: Logs Guidance)
Log Messages
``` INSERT LOG MESSAGES HERE ```