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] StorageUploadTask's event stream is never closed #2141

Closed
jenshor opened this issue Mar 8, 2020 · 9 comments
Closed

[firebase_storage] StorageUploadTask's event stream is never closed #2141

jenshor opened this issue Mar 8, 2020 · 9 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. 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

@jenshor
Copy link

jenshor commented Mar 8, 2020

Describe the bug
The stream of the StorageUploadTask's events property is not closed; Therefore, awaiting events.last will never return.

To Reproduce

Code for reproduction:

StorageReference storageReference = FirebaseStorage.instance.ref();
StorageUploadTask uploadTask = storageReference.putFile(file);
await uploadTask.events.last;

Expected behavior
The stream is properly closed when the file is successfully uploaded.

Additional context
I dug a bit into the code of the StorageUploadTask implementation and it seems that the StreamController<StorageTaskEvent> _controller is never closed. Therefore, I changed the implementation locally on my system by closing _controller when a StorageTaskEvent with a StorageTaskEventType of StorageTaskEventType.success occurred. Closing the controller had the effect that the await events.last; call returned the moment the file was successfully uploaded. I think the described fix might be related to #1314

flutter doctor -v:

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-DE)
    • Flutter version 1.12.13+hotfix.8 at /Users/jenshorstmann/Development/flutter
    • Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/jenshorstmann/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/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.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.42.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.1

[✓] Connected device (1 available)
    • iPhone 11 Pro • 2F1C2C71-5CDA-4630-A540-66FD1496D425 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

pubspec.yaml

name: project_name
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  google_fonts: ^0.3.2
  font_awesome_flutter: ^8.5.0
  flutter_launcher_icons: ^0.7.4
  url_launcher: ^5.4.1
  flutter_bloc: ^3.2.0
  firebase_auth: ^0.15.4
  google_sign_in: ^4.1.1
  intl: ^0.16.1
  firebase_core: ^0.4.3+3
  timeago: ^2.0.26
  uuid: ^2.0.4
  cloud_firestore: ^0.13.4+1
  image_picker: ^0.6.3+4

Log

flutterRunLogFile.txt

@jenshor jenshor added the type: bug Something isn't working label Mar 8, 2020
@Ahmadre
Copy link

Ahmadre commented Mar 8, 2020

Same!!!

@iapicca
Copy link

iapicca commented Mar 9, 2020

Hi @jenshor
can you please provide your flutter run --verbose
and your pubspec.yaml
Thank you

@iapicca iapicca added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Mar 9, 2020
@jenshor
Copy link
Author

jenshor commented Mar 9, 2020

I added the parts of the pubspec.yaml which I think are important. I also sent the flutter run --verbose log to logs@dartcode.org

@iapicca
Copy link

iapicca commented Mar 10, 2020

Hi @jenshor
I have no way to retrieve your logs,
could you please paste it in a comment or attach as txt file
thank you

@jenshor
Copy link
Author

jenshor commented Mar 10, 2020

Alright. Attached the logfile to the post.

@iapicca iapicca removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Mar 10, 2020
@Ehesp Ehesp added plugin: storage impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) labels Apr 23, 2020
@charithreddyv
Copy link

I have similar kind of issue when using firebase_storage
I have added my GoogleService-Info.plist to ios/Runner from Xcode and on my main.dart i have added
await Firebase.initializeApp();, cloud_firestore: ^0.14.0+2 works good i am able to CRUD data but when using fireStore to upload files the ios app crashes the only thing that comes in terminal when run on verbose mode is:
[+123976 ms] Service protocol connection closed. [ +1 ms] Lost connection to device. [ +35 ms] DevFS: Deleting filesystem on the device (file:///Users/Me/Library/Developer/CoreSimulator/Devices/12E19722-CC83-452B-B263-EF624D069BED/dat a/Containers/Data/Application/BC48EA57-B913-4281-9628-59C783B0FE77/tmp/app28vRsI/app/) [ +258 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed [ +4 ms] "flutter run" took 223,298ms. [ +271 ms] ensureAnalyticsSent: 264ms [ +2 ms] Running shutdown hooks [ ] Shutdown hook priority 4 [ +7 ms] Shutdown hooks complete [ +2 ms] exiting with code 0
i have gone further adding CFBundleURLSchemes with my REVERSED_CLIENT_ID but that did not make any difference
the firebase packages i have on my pubspec are:
firebase_core: ^0.5.0 cloud_firestore: ^0.14.0+2 firebase_storage: ^4.0.0 firebase_messaging: ^7.0.0
this only happens on ios android works fine

Thanks in advance

@Salakar Salakar added the Stale Issue with no recent activity label Apr 1, 2021
@russellwheatley
Copy link
Member

Hey @jenshor, given the amount of change to firebase_storage package, are you able to update to the latest version and confirm if this is still an issue?

@google-oss-bot google-oss-bot added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Stale Issue with no recent activity labels Apr 22, 2021
@google-oss-bot
Copy link

Hey @jenshor. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label May 3, 2021
@russellwheatley
Copy link
Member

Given the rework #3612 and lack of response, I'm going to assume this isn't an issue anymore. Will reopen if this is not the case.

@firebase firebase locked and limited conversation to collaborators Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. 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

8 participants