Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase storage] uploadTask.events.listen() fires weird events #1314

Closed
logemann opened this issue Oct 25, 2019 · 4 comments
Closed

[firebase storage] uploadTask.events.listen() fires weird events #1314

logemann opened this issue Oct 25, 2019 · 4 comments
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: storage Stale Issue with no recent activity type: bug Something isn't working

Comments

@logemann
Copy link

logemann commented Oct 25, 2019

Describe the bug
I am implementing an upload progress bar (definite) with the help of uploadTask.events.listen().

In the callback i computing percents of upload completion like this:

callback: (StorageTaskEvent event) {
    // this is form 0.0 to 1.0
   double percent = event.snapshot.bytesTransferred / event.snapshot.totalByteCount;
}

Imagine i have a print() statement right in the callback. The log looks like this:

13:28:37.163347 - Bytes 85 von 219131 --) 0.03878958248718803 %
13:28:40.099999 - Bytes 16469 of 219131 --) 7.5155956938999955 %
13:28:40.101480 - Bytes 32853 of 219131 --) 14.992401805312806 %
13:28:40.102404 - Bytes 49237 of 219131 --) 22.469207916725612 %
13:28:40.103234 - Bytes 65620 of 219131 --) 29.945557680109157 %
13:28:40.984518 - Bytes 82004 of 219131 --) 37.42236379152197 %
13:28:40.987146 - Bytes 98388 of 219131 --) 44.89916990293478 %
13:28:40.988821 - Bytes 98389 of 219131 --) 44.89962625096403 %
13:28:40.990674 - Bytes 114773 of 219131 --) 52.376432362376846 %
13:28:40.992537 - Bytes 131157 of 219131 --) 59.85323847378965 %
13:28:40.993965 - Bytes 147541 of 219131 --) 67.33004458520246 %
13:28:40.995440 - Bytes 163925 of 219131 --) 74.80685069661527 %
13:28:40.996644 - Bytes 180309 of 219131 --) 82.28365680802807 %
13:28:40.997861 - Bytes 196693 of 219131 --) 89.76046291944088 %
13:28:40.998986 - Bytes 213077 of 219131 --) 97.2372690308537 %
13:28:41.000252 - Bytes 219131 of 219131 --) 100.0 %
13:28:52.824658 - Bytes 219131 of 219131 --) 100.0 %
13:28:52.826356 - Bytes 219131 of 219131 --) 100.0 %

Pay attention to the first 100% output and the following two 100%. There is a gap of 11 seconds and this is most likely the upload itself of 219kb The uploadTask.onComplete Future is completed after the last 100% line.

As you can see, its impossible to make a proper upload progress bar with these numbers. The only thing i do is to throttle the Network speed via iOS -> Settings -> Developer -> Network Link Conditioner and set it to Edge to test larger upload durations. Dont know if its related.

To Reproduce
Just implement a callback yourself on an Cloud Storage Upload as described above.

Expected behavior
Only one Event fired when 100% and the one event should be right before the Future completes.

@logemann logemann added the type: bug Something isn't working label Oct 25, 2019
@iapicca
Copy link

iapicca commented Oct 25, 2019

Hi @logemann
can you please provide your updated flutter doctor -v
and your flutter run --verbose ?
Also, to better address the issue, would be helpful
if you could post a self contained app on github
or the steps to reproduce it.
Thank you

@iapicca iapicca added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 25, 2019
@logemann
Copy link
Author

i can provide flutter doctor but self contained app is impossible cause it would involve a Cloud Storage account to upload something....

[✓] Flutter (Channel dev, v1.10.14, on Mac OS X 10.15 19A602, locale de-DE)
• Flutter version 1.10.14 at /Users/ml/development/flutter
• Framework revision 1946fc4da0 (3 weeks ago), 2019-10-07 15:23:31 -0700
• Engine revision 1d62160fdb
• Dart version 2.6.0 (build 2.6.0-dev.1.0 d6c6d12ebf)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/ml/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Users/ml/software/editor/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.7.0.rc.1

[✓] Android Studio (version 3.5)
• Android Studio at /Users/ml/software/editor/Android Studio.app/Contents
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
• iPhone Xʀ • C3565AFC-01CB-47DA-8EB8-62FFBBCD9B84 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

@logemann
Copy link
Author

If someone is really willing to test it with their Firebase Account. I could at least provide a small test app.

@iapicca iapicca removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Nov 20, 2019
@Ehesp Ehesp added impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: storage labels Apr 21, 2020
@Salakar Salakar added the Stale Issue with no recent activity label Apr 1, 2021
@Salakar
Copy link
Member

Salakar commented Apr 16, 2021

Closing in favour of trying the latest Storage plugin which has since been refactored and a lot of underlying issues fixed. Thanks.

@Salakar Salakar closed this as completed Apr 16, 2021
@firebase firebase locked and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: storage Stale Issue with no recent activity type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants