flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Firebase crash report because of "Connection closed before full header was received"

Open marcellocamara opened this issue 3 years ago • 11 comments

🐛 Bug Report

This packages have some trouble when download multiple images on the same view.

This bug is evident when use this config on your app to log the error on Firebase Crashlytics: FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;

So, how can we care of it to avoid those crashs ?

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Connection closed before full header was received. Error thrown Instance of 'aA'.\
       at .#0      FirebaseCrashlytics.recordError (package:firebase_crashlytics/src/firebase_crashlytics.dart:119:22)
       at .#1      FirebaseCrashlytics.recordFlutterError (package:firebase_crashlytics/src/firebase_crashlytics.dart:141:12)
       at .#2      FirebaseCrashlytics.recordFlutterFatalError (package:firebase_crashlytics/src/firebase_crashlytics.dart:156:12)
       at .#3      FirebaseCrashlytics.recordFlutterFatalError (package:firebase_crashlytics/src/firebase_crashlytics.dart:154:3)
       at .#4      FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1184:14)
       at .#5      ImageStreamCompleter.reportError (package:flutter/src/painting/image_stream.dart:733:20)
       at .#6      new MultiImageStreamCompleter.<anonymous closure> (package:cached_network_image/src/image_provider/multi_image_stream_completer.dart:32:7)
       at .#7      _RootZone.runBinaryGuarded (dart:async/zone.dart:1598:10)
       at .#8      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:358:15)
       at .#9      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:376:7)
       at .#10     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
       at .#11     _SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:778:19)
       at .#12     _StreamController._addError (dart:async/stream_controller.dart:656:7)
       at .#13     _StreamController.addError (dart:async/stream_controller.dart:610:5)
       at .#14     _AsyncStarStreamController.addError (dart:async-patch/async_patch.dart:227:16)
       at .#15     _SuspendState._handleException (dart:async-patch/async_patch.dart:564:20)
       at .#16     _SuspendState._createAsyncCallbacks.thenCallback (dart:async-patch/async_patch.dart:344:7)
       at .#17     _RootZone.runUnary (dart:async/zone.dart:1653:54)
       at .#18     _FutureListener.handleValue (dart:async/future_impl.dart:147:18)
       at .#19     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:766:45)
       at .#20     Future._propagateToListeners (dart:async/future_impl.dart:795:13)
       at .#21     Future._completeWithValue (dart:async/future_impl.dart:566:5)
       at .#22     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:639:7)
       at .#23     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
       at .#24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
       at .#25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:44:1)

My environment

environment:
  sdk: ">=2.18.0 <3.0.0"
  flutter: "3.3.0"

Expected behavior

Do not crash

Reproduction steps

Create a page with a lot of images and open this page. Some of those images will not be loaded

Configuration

Version: cached_network_image: ^3.2.2

Platform:

  • [x] :iphone: iOS
  • [x] :robot: Android

marcellocamara avatar Sep 09 '22 02:09 marcellocamara

The same issue facing with multiple devices. Customer can not visible images sometimes in the grid.

manish9161 avatar Sep 30 '22 05:09 manish9161

Have a similar issue in crashlytics, but non-fatal

Screenshot 2022-11-18 at 11 38 42

TimYusR avatar Nov 18 '22 10:11 TimYusR

I'm facing the same issue

davidgalarza avatar Jun 15 '23 21:06 davidgalarza

any solution to this issue?

Mohit8G avatar Aug 09 '23 07:08 Mohit8G

any updates?

VB10 avatar Oct 19 '23 14:10 VB10

Any update yet?

haashem avatar Jan 17 '24 12:01 haashem

For those who are getting these crash as fatal crash. https://medium.com/@rishyash8/flutter-firebase-crash-report-because-of-connection-closed-before-full-header-was-received-7ace6e84bc5d

Rishyash avatar Jan 20 '24 15:01 Rishyash

any updates ???

Abdelaty avatar Feb 21 '24 13:02 Abdelaty

@Rishyash

For those who are getting these crash as fatal crash. https://medium.com/@rishyash8/flutter-firebase-crash-report-because-of-connection-closed-before-full-header-was-received-7ace6e84bc5d

By doing this you're ignoring this exceptions and not logging them into Firebase Crashlytics. I think we need, with this issue, is a resolution to not throw an exception and loads the image correctly.

marcellocamara avatar Feb 21 '24 13:02 marcellocamara

@Rishyash

For those who are getting these crash as fatal crash. https://medium.com/@rishyash8/flutter-firebase-crash-report-because-of-connection-closed-before-full-header-was-received-7ace6e84bc5d

By doing this you're ignoring this exceptions and not logging them into Firebase Crashlytics. I think we need, with this issue, is a resolution to not throw an exception and loads the image correctly.

https://medium.com/@rishyash8/how-to-load-network-image-in-flutter-with-retry-functionality-837db9809662 this might help

Rishyash avatar Feb 25 '24 16:02 Rishyash

any updates ???

https://medium.com/@rishyash8/how-to-load-network-image-in-flutter-with-retry-functionality-837db9809662

Rishyash avatar Feb 25 '24 16:02 Rishyash