aws-amplify / aws-amplify/amplify-android
[Storage]: Multi-part upload results in many progress updates with 100% status
- Dominant language
- Java
- Stars
- 287
- Forks
- 132
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 45
Description
### Before opening, please confirm:
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).
### Language and Async Model
Kotlin
### Amplify Categories
Storage
### Gradle script dependencies
```groovy
// Put output below this line
```
### Environment information
```
# Put output below this line
```
### Please include any relevant guides or documentation you're referencing
_No response_
### Describe the bug
When uploading a file over 5mb Amplify performs a multi-part upload. When this upload completes there are multiple progress updates sent in a burst with a completion percentage of 100%. The number of such updates appears to be proportional to the size of the file - for a file measuring 472mb, I noted that this resulted in several hundred callbacks.
There should only be one progress update sent with a completion percentage of 100%.
### Reproduction steps (if applicable)
1. Create an app that can upload a file to S3 with Amplify
2. Attempt to upload a file that is >= 5mb. This will result in a multi-part upload.
3. Observe the progress updates received. Note that there are multiple callbacks with progress == 1.0. The larger the file, the higher the number of such callbacks received.
### Code Snippet
```kotlin
Amplify.Storage.uploadFile(
StoragePath.fromString(path),
file,
StorageUploadFileOptions.defaultInstance(),
{ Log.i("MyAmplifyApp", "Fraction completed: ${it.fractionCompleted} (${it.currentBytes} / ${it.totalBytes})") },
{ Log.i("MyAmplifyApp", "Successfully uploaded: ${it.path}") },
{ Log.e("MyAmplifyApp", "Upload failed", it) }
)
```
### Log output
```
// Put your logs below this line
```
### amplifyconfiguration.json
_No response_
### GraphQL Schema
```graphql
// Put your schema below this line
```
### Additional information and screenshots
_No response_
Contributor guide
Research direction
Start with the Amplify.Storage.uploadFile entry point and reproduce the issue using a file at least 5 MB, observing fractionCompleted callbacks during multipart upload. Done means a multipart upload emits only one progress update with fractionCompleted at 1.0, while still reporting successful completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, kotlin
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100