flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

App CRASH: MultiImageStreamCompleter: Connection refused. Error thrown Instance of 'ErrorDescription'.

Open jpetro416 opened this issue 2 years ago • 26 comments
trafficstars

🐛 Bug Report

Rapid scrolling produces this crash:

new MultiImageStreamCompleter.<fn>
FlutterError - Connection refused. Error thrown Instance of 'ErrorDescription'.
package:cached_network_image/src/image_provider/multi_image_stream_completer.dart:32

Expected behavior

Image url's are fine and work most of the time, rapid scrolling produces this crash

Reproduction steps

Rapid scrolling of grid images/list images over 20 produces this crash:

Widget displayImage(String picUrl, double size) => CachedNetworkImage(
    memCacheWidth: size.toInt(),
    imageBuilder: (context, imageProvider) =>
        _getFlatImageProvider(imageProvider, size, context),
    imageUrl: picUrl,
    placeholder: (context, url) => _getFlatPlaceholderOrErrorImage(size, true),
    errorWidget: (context, url, error) =>
        _getFlatPlaceholderOrErrorImage(size, false));

Configuration

Version: cached_network_image: ^3.2.3

Platform:

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

jpetro416 avatar Mar 13 '23 18:03 jpetro416

same error I think

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Software caused connection abort. Error thrown Instance of 'ErrorDescription'. at FirebaseCrashlytics.recordError(firebase_crashlytics.dart:120) at FirebaseCrashlytics.recordFlutterError(firebase_crashlytics.dart:144) at FirebaseCrashlytics.recordFlutterFatalError(firebase_crashlytics.dart:157) at FlutterError.reportError(assertions.dart:1177) at ImageStreamCompleter.reportError(image_stream.dart:728) at new MultiImageStreamCompleter.(multi_image_stream_completer.dart:32)

macy11 avatar Mar 28 '23 07:03 macy11

same in Flutter 3.7.10 with cached_network_image 3.2.3:

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Connection reset by peer. Error thrown Instance of 'ErrorDescription'.
       at FirebaseCrashlytics.recordError(firebase_crashlytics.dart:120)
       at FirebaseCrashlytics.recordFlutterError(firebase_crashlytics.dart:146)
       at FirebaseCrashlytics.recordFlutterFatalError(firebase_crashlytics.dart:159)
       at main.<fn>(main.dart:28)
       at FlutterError.reportError(assertions.dart:1189)
       at ImageStreamCompleter.reportError(image_stream.dart:738)
       at new MultiImageStreamCompleter.<fn>(multi_image_stream_completer.dart:32)
       at _SuspendState._createAsyncStarCallback.<fn>(dart:async)
       at new MultiImageStreamCompleter.<fn>(multi_image_stream_completer.dart:25)

prilepskiy avatar Apr 10 '23 16:04 prilepskiy

Flutter 3.7.6 with cached_network_image 3.2.3:

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: HandshakeException: Connection terminated during handshake. Error thrown Instance of 'ErrorDescription'.
       at FirebaseCrashlytics.recordError(firebase_crashlytics.dart:120)
       at FirebaseCrashlytics.recordFlutterError(firebase_crashlytics.dart:146)
       at FlutterError.reportError(assertions.dart:1189)
       at ImageStreamCompleter.reportError(image_stream.dart:738)
       at new MultiImageStreamCompleter.<fn>(multi_image_stream_completer.dart:32)
       at _SuspendState._createAsyncStarCallback.<fn>(dart:async)
       at new MultiImageStreamCompleter.<fn>(multi_image_stream_completer.dart:25)

chuiizeet avatar Apr 12 '23 01:04 chuiizeet

have the same issue

LatCui avatar Apr 17 '23 07:04 LatCui

hello?

prilepskiy avatar May 10 '23 09:05 prilepskiy

have the same issue

meg4cyberc4t avatar May 10 '23 09:05 meg4cyberc4t

I also faced the same issue.

ye-ha avatar Jul 06 '23 06:07 ye-ha

waiting too

mdmota avatar Jul 08 '23 19:07 mdmota

I am also facing this issue

sajaadem avatar Jul 31 '23 08:07 sajaadem

⚠️We are all waiting @renefloor cached_network_image: 3.2.3

Everyone else: This is a critical bug, and I have removed this package from my project and instead used this basic code below as a workaround, which surprisingly does NOT crash the app.


Widget displayImage(String picUrl, double size) {
  return Image.network(
    picUrl,
    width: size,
    height: size,
    fit: BoxFit.cover,
    errorBuilder: (context, error, stackTrace) {
      print(error);
      return _getFlatPlaceholderOrErrorImage(size, false);
    },
    loadingBuilder: (context, Widget child, ImageChunkEvent? loadingProgress) {
      if (loadingProgress == null) return child;
      return Center(
        child: new CircularProgressIndicator(backgroundColor: Colors.white,),
      );
    },
  );
}

Widget _getFlatPlaceholderOrErrorImage(double size, bool placeholder) =>
    Container(
      width: size,
      height: size,
      child: Image.asset(
        placeholder
            ? 'assets/images/placeholder_image.png'
            : 'assets/images/error.png',
        fit: BoxFit.contain,
        color: Colors.grey,
        height: size - 50,
        width: size - 50,
      ),
    );

jpetro416 avatar Aug 02 '23 01:08 jpetro416

Same issue posted here as well: https://github.com/Baseflow/flutter_cached_network_image/issues/859

jpetro416 avatar Aug 03 '23 14:08 jpetro416

@jpetro416 version 3.2.3 is already published but the issue still exist ...

sajaadem avatar Aug 04 '23 06:08 sajaadem

i am seeing this crash on ios in production, not debug. there has been discussion here and here but nobody seemed to have really solved it yet.

$ flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.80.2) [✓] Connected device (2 available) [✓] Network resources

• No issues found!

tomquas avatar Aug 09 '23 07:08 tomquas

+1

MaximilianFlechtner avatar Sep 21 '23 12:09 MaximilianFlechtner

have the same issue

AshishDoubleDotts avatar Nov 08 '23 07:11 AshishDoubleDotts

Same issue here:

new MultiImageStreamCompleter.<fn>
FlutterError - Operation timed out. Error thrown resolving an image codec.
package:cached_network_image/src/image_provider/multi_image_stream_completer.dart:32

and in the details:

Fatal Exception: FlutterError
ClientException: Connection closed before full header was received, uri=https://www.gstatic.com/webp/gallery/1.webp. Error thrown resolving an image codec.

iballan avatar Nov 23 '23 20:11 iballan

We also have a lot of this bugs in production on Android

gvozditskiy avatar Dec 21 '23 16:12 gvozditskiy

What I'm testing now is this: In my pubspec.yaml: Instead of cached_network_image: I imported this from my repo:

  cached_network_image: # Temporary until they fix it here
    git:
      url: https://github.com/iballan/flutter_cached_network_image
      path: cached_network_image
      ref: develop

I added error listener to the image:

return CachedNetworkImage(
      imageUrl: url ?? Constants.defaultImageUrl,
      fit: fit,
      width: width,
      height: height,
      progressIndicatorBuilder: (context, url, downloadProgress) => LoadingIndicator(),
      errorListener: (error) {  // <- this is the listener needed to not rethrow errors in my modification
        Timber.w('Error loading image: $error');
      },
      errorWidget: (context, url, error) => Center(
        child: ErrorWidget(width: width, height: height),
      ),
    );

The change I've done on the original repo is this commit: Link When there is an error, instead of rethrowing, i just call the errorListener:

      if (errorListener != null) {
        errorListener(e);
      } else {
        rethrow;
      }

I'm hoping that this fixed it. Otherwise i will have to remove more error handling and suppress error more in this library!

I'm not sure why even though on top of errorListener, and errorWidget the error is thrown out !? Why would that be the case? I don't think anybody want to crash the app if the image didn't load tho

iballan avatar Dec 21 '23 19:12 iballan

I released an update with the fix above and until now it looks like the issue didn't appear on the latest version!

iballan avatar Dec 24 '23 21:12 iballan

Yess, after the fix above I can say that it was fixed for me! I don't see related crash reports anymore!

EDIT: Opened this PR https://github.com/Baseflow/flutter_cached_network_image/pull/908

iballan avatar Dec 27 '23 14:12 iballan

I'm in the latest version 3.3.1 and the issue not fixed

MortadhaFadhlaoui avatar May 06 '24 12:05 MortadhaFadhlaoui