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

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

Open
1 task
jpetro416 opened this issue Mar 13, 2023 · 25 comments

Comments

@jpetro416
Copy link

jpetro416 commented Mar 13, 2023

🐛 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 ] 📱 iOS
  • 🤖 Android
@macy11
Copy link

macy11 commented Mar 28, 2023

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)

@prilepskiy
Copy link

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)

@chuiizeet
Copy link

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)

@LatCui
Copy link

LatCui commented Apr 17, 2023

have the same issue

@prilepskiy
Copy link

hello?

@meg4cyberc4t
Copy link

have the same issue

@hayeonhee
Copy link

I also faced the same issue.

@mdmota
Copy link

mdmota commented Jul 8, 2023

waiting too

@sajaadem
Copy link

I am also facing this issue

@jpetro416
Copy link
Author

jpetro416 commented Aug 2, 2023

⚠️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
Copy link
Author

Same issue posted here as well:
#859

@sajaadem
Copy link

sajaadem commented Aug 4, 2023

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

@tomquas
Copy link

tomquas commented Aug 9, 2023

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!

@MaximilianFlechtner
Copy link

+1

@AshishDoubleDotts
Copy link

have the same issue

@iballan
Copy link

iballan commented Nov 23, 2023

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.

@gvozditskiy
Copy link

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

@iballan
Copy link

iballan commented Dec 21, 2023

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
Copy link

iballan commented Dec 24, 2023

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

@iballan
Copy link

iballan commented Dec 27, 2023

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 #908

@MortadhaFadhlaoui
Copy link

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

@YonatanSegura97
Copy link

Any solution?, My Crashlytics dashboard shows a lot of exceptions. Please provide a solution.

@jpetro416
Copy link
Author

Will someone patch this? I don't use the package anymore, but this package needs this patch

@maxAtIppen
Copy link

I still have the same issue.

Versions:

Flutter 3.24.2
flutter_cached_network_image 3.3.1

From Crashlytics:

ClientException with SocketException: Software caused connection abort (OS Error: Software caused connection abort, errno = 103),

new MultiImageStreamCompleter. (multi_image_stream_completer.dart:26)

@dinhtuquyen
Copy link

I still have the same issue
Flutter 3.24.3
flutter_cached_network_image 3.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests