flutter_cached_network_image
flutter_cached_network_image copied to clipboard
App CRASH: MultiImageStreamCompleter: Connection refused. Error thrown Instance of 'ErrorDescription'.
🐛 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
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.
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)
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)
have the same issue
hello?
have the same issue
I also faced the same issue.
waiting too
I am also facing this issue
⚠️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,
),
);
Same issue posted here as well: https://github.com/Baseflow/flutter_cached_network_image/issues/859
@jpetro416 version 3.2.3 is already published but the issue still exist ...
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!
+1
have the same issue
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.
We also have a lot of this bugs in production on Android
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
I released an update with the fix above and until now it looks like the issue didn't appear on the latest version!
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
I'm in the latest version 3.3.1 and the issue not fixed