flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.18k stars 27.49k forks source link

Network Image - Connection closed before full header was received... #25107

Closed abinmittu closed 5 years ago

abinmittu commented 5 years ago

Network image throwing this exception on a random image. I have a list of image thumbnails, when clicked on any, the full size image is fetched using Image.network. Suppose i have 10 images and the exception was caught on clicking the 5th image. On running the app again the exception will be on a different image say 8th one.

flutter: When the exception was thrown, this was the stack:
flutter: #0      NetworkImage._loadAsync (package:flutter/src/painting/image_provider.dart:490:41)
flutter: <asynchronous suspension>
flutter: #1      NetworkImage.load (package:flutter/src/painting/image_provider.dart:471:14)
flutter: #2      ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:267:86)
flutter: #3      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:143:20)
flutter: #4      ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:267:63)
flutter: #5      SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
flutter: #6      ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:265:30)
flutter: #7      _ImageState._resolveImage (package:flutter/src/widgets/image.dart:630:20)
flutter: #8      _ImageState.didChangeDependencies (package:flutter/src/widgets/image.dart:605:5)
flutter: #9      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3846:12)
flutter: #10     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #11     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #12     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #13     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #14     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #15     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #16     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
flutter: #17     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #18     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #19     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #20     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #21     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #22     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #23     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #24     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #25     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #26     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #27     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #28     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #29     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #30     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #31     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #32     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #33     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #34     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #35     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #36     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #37     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #38     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #40     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4965:32)
flutter: #41     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #42     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #43     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #44     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #45     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #46     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #47     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #48     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #49     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #50     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #51     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #52     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
flutter: #53     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #54     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #55     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #56     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #57     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #58     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #59     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #60     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #61     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #62     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #63     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #64     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #65     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #66     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #67     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #68     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #69     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #70     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #71     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #72     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #73     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #74     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #75     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #76     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #77     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #78     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #79     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #80     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
flutter: #81     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #82     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #83     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #84     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4860:14)
flutter: #85     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #86     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #87     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #88     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #89     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #90     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
flutter: #91     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #92     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #93     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #94     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #95     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #96     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #97     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #98     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #99     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #100    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #101    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #102    ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #103    ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #104    Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #105    Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #106    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #107    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #108    ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #109    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #110    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #111    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #112    ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #113    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #114    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4585:32)
flutter: #115    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4975:17)
flutter: #116    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #117    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #118    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #119    StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #120    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #121    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #122    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #123    ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #124    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #125    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #126    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #127    StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #128    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #129    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #130    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #131    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #132    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #133    StatelessElement.update (package:flutter/src/widgets/framework.dart:3781:5)
flutter: #134    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #135    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #136    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #137    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #138    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #139    StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #140    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #141    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #142    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #143    StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #144    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #145    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #146    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #147    ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #148    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #149    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #150    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #151    ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #152    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #153    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #154    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #155    StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #156    Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #157    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #158    Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #159    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2286:33)
flutter: #160    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:676:20)
flutter: #161    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
flutter: #162    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #163    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
flutter: #164    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
flutter: #165    _invoke (dart:ui/hooks.dart:154:13)
flutter: #166    _drawFrame (dart:ui/hooks.dart:143:3)
flutter doctor -v
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.13.6 17G65, locale en-US)
    • Flutter version 1.0.0 at /Users/abin/Desktop/flutter
    • Framework revision 5391447fae (8 days ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/abin/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 30.0.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • iPhone • 471e474a22042029ba21ad7a73cf34c763a2f35c • ios • iOS 12.0.1
zoechi commented 5 years ago

Looks similar to #13747

psyanite commented 5 years ago

I get this error very very intermittently on my environment.

I have wifi Windows 10 PC running GraphQL NodeJS Express server on 192.168.1.5, trying to do http (not https) requests on http://192.168.1.5. I have a Genymotion Android phone running.

This error occurred repeatedly for one particular query type. But I somehow fixed it by changing the code to wait for response or something like that.

zoechi commented 5 years ago

Do you have wireless debugging enabled?

psyanite commented 5 years ago

I remember the issue occured on Genymotion (android emulator) on the same computer I was using intellij.

I ran flutter in debug mode via intellij and that's where I saw the error.

I think I fixed it by doing an await on the Future function which did the call.

pushangupta commented 5 years ago

If you are making connection requests inside a future which you should, make sure its an asynchronous task with await properly used. Also as a side note for images, use a placeholder just in case your app misses to fetch from network

westy92 commented 5 years ago

I'm getting this error frequently as well.

I/flutter (15859): Another exception was thrown: HttpException: Connection closed before full header was received, uri = https://static.checkiday.com/img/600/doctor-563428.jpg

Could this be related to this known bug? https://github.com/dart-lang/sdk/issues/21798

westy92 commented 5 years ago

Some context to my use case:

I am going to display multiple images in a list, so I precache them:

for (Event event in _events) {
  precacheImage(NetworkImage(event.image), context);
}

Then I use the image that was preloaded:

FadeInImage(
  placeholder: const AssetImage('assets/placeholder.jpg'),
  image: NetworkImage(event.image),
  fit: BoxFit.cover,
  width: double.infinity,
  height: 256,
),
zoechi commented 5 years ago

@westy92 you probably need to do same rate limit to avoid too many concurrent requests.

zoechi commented 5 years ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.

psyanite commented 5 years ago

@westy92

I recently changed some code to wrap my image with a DecorationImage, I wonder if this might fix your problem?

westy92 commented 5 years ago

I switched from using precacheImage() to using cacheExtent and am seeing the error less, which makes me think it is indeed due to too many concurrent connections.

I'd like to rate-limit NetworkImage, but can't find a way to do so. If I had access to the underlying HttpClient, I'm guessing I could set maxConnectionsPerHost.

westy92 commented 5 years ago

I figured out how to limit the connections on the underlying HttpClient of NetworkImage!

I globally overrode the HttpClient: (ref: https://github.com/flutter/flutter/issues/19588)

class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext context) {
    return super.createHttpClient(context)
        ..maxConnectionsPerHost = 5;
  }
}

void main() {
  HttpOverrides.global = MyHttpOverrides();
  runApp(MyApp());
}

Hopefully this fixes my issue. Thanks for the connections tip!

vinayakprasad96 commented 5 years ago

Hi,

I need to display a list of products and each product has an image and some details. I'm using silverlist for this purpose. I'm frequently getting " Another exception was thrown: HttpException: Connection closed before full header was received, uri = https://zoomtail-processed-images.s3.ap-south-1.amazonaws.com/raw-images/raw-W0104-005493_1.webp" this error and the above solution of overriding the global httpclient doesn't help for me.

I've tried to pre cache the network image and also tried using cacheextent, but to no avail. Could you help me with this?

Thanks.

cfchris commented 5 years ago

If anyone figures out a solution, will you please, post it.

(repost from #21798)

We are building a companion application to our web-based CRM. One of the features is sms/mms. Because the information might be private, we are serving the images behind an authenticated API that redirects (302) to an S3 short term URL (5 minutes).

Anecdotally, I can say NetworkImage seems fine on conversations that only have a few images (like 2 or 3). On a conversation thread that I am using that has 9 images, frequently one or two of them will have this issue immediately. (I will get the error Connection closed before full header was received, uri = ... in the "debug console" and those images will not load.

(A coworker pointed out that if you copy the address from the error in the debug console and paste it in a browser, it loads and is valid.)

It's going to be very embarassing if randomly, sometimes, some of the images won't show up. :-(

cfchris commented 5 years ago

I finally stumbled on a StackOverflow that mentioned fixing this with cached_network_image package. I tried it out and it did fix the issue. It also had the added benefit of making the screens faster on subsequent views (because images are cached locally now).

So, although the issue still remains for others, I'm happy that I was forced to find CachedNetworkImage().

It was a very easy drop-in replacement for NetworkImage, here are the two places I had to change (the second being only a tiny bit more complex).

// BEFORE:
          child: ClipRRect(
            borderRadius: borderRadius,
            child: Image.network(imageUrl),
          ),
// AFTER:
          child: ClipRRect(
            borderRadius: borderRadius,
            child: CachedNetworkImage(
              imageUrl: imageUrl,
              errorWidget: (context, url, error) => Icon(Icons.error),
            ),

// BEFORE:
            Expanded(
              child: PhotoView(
                imageProvider: NetworkImage(images[currentIndex].imageUrl),
              ),
            ),
// AFTER
            Expanded(
              child: CachedNetworkImage(
                imageUrl: images[currentIndex].imageUrl,
                imageBuilder: (context, imageProvider) =>
                    PhotoView(imageProvider: imageProvider),
              ),
            ),
edocabhi commented 4 years ago

@cfchris CachedNetworkImage was good to know but unfortunately, that doesn't solve the original issue here. I have same use case as yours and CachedNetworkImage just reduces the frequency but does not resolve completely. Did you experience the issue again?

edocabhi commented 4 years ago

@zoechi Maybe this issue needs to be reopened as the issue still persists. I am downloading image from a s3 bucket with pre signed url and it randomly fails.

uc-dve commented 4 years ago

Issue is still persist. Please look into it. it randomly fails, specially when we swipe through pages and there are multiple network request.

image

edocabhi commented 4 years ago

@uc-dve I fixed it using this https://pub.dev/packages/dynamic_url_image_cache

giohappy commented 4 years ago

Same for me, testing flutter_map sample app:

image

gabcarneiro commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

2math commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

Nice hack 👍

ayush221b commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

I don't know how this worked, or why this worked, but it was the only thing that worked

khalid-alsaleh-dev commented 4 years ago

any solutions for this issue , please ???

2math commented 4 years ago

any solutions for this issue , please ???

On my side converting urls on AWS to http didn't do the trick, I had to use that lib instead "optimized_cached_image" and it works as expected

czredhat commented 4 years ago

I have the same issue. Random image occasionally failed with this error: Connection closed before full header was received . Changing url from https to http doesnt help.

Zeswen commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

Thank you for the fix! However, It is really sad that I cannot use an HTTPS connection for images in Flutter. I hope this gets fixed soon.

FYI I am using S3 bucket images and 5 out of 50 are failing with Connection closed before full header was received. I am also using cached_network_image to render the images.

Ali-hd commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

I don't know how this worked, or why this worked, but it was the only thing that worked

How do you change the request from HTTPS to HTTP 🤔? I'm having the same problem with NetworkImage

gabcarneiro commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

I don't know how this worked, or why this worked, but it was the only thing that worked

How do you change the request from HTTPS to HTTP ? I'm having the same problem with NetworkImage

What i meant by that is literally changing the request from https://mys3bucket.amazonaws.com to http://mys3bucket.amazonaws.com. I could only do that becouse the s3 bucket i am using allows me to work with http or https requests.

For those using the package cached_network_image, i made a gist with my solution https://gist.github.com/gabcarneiro/02580611279c85179db015ad2c7ed936

Ali-hd commented 4 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

I don't know how this worked, or why this worked, but it was the only thing that worked

How do you change the request from HTTPS to HTTP ? I'm having the same problem with NetworkImage

What i meant by that is literally changing the request from https://mys3bucket.amazonaws.com to http://mys3bucket.amazonaws.com. I could only do that becouse the s3 bucket i am using allows me to work with http or https requests.

For those using the package cached_network_image, i made a gist with my solution https://gist.github.com/gabcarneiro/02580611279c85179db015ad2c7ed936

Great thanks. I just applied this to all my links .replaceAll('https', 'http')

ahuruConnect commented 4 years ago

I'm getting the same issue here. Should really fix this.

hikui commented 3 years ago

I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.

Could be a workaround but far from ideal. HTTPS request is such a basic feature of any platform yet the flutter one is so buggy.

vijineyyal commented 3 years ago

Is this issue fixed? I still face this Issue while fetching from S3 Bucket..Anyone who have Fix please Share Changing HTTPS to HTTP is not good in security Perpective..Any Thoughts and Fixes?

gopalkriagg commented 3 years ago

I am also facing this issue that fetching image from s3 randomly fails. Please fix this.

oswaldocueto01 commented 3 years ago

I have the same issue

intoxicated commented 3 years ago

does anyone look into this problem?

FabioPagano commented 3 years ago

In my case (error "HttpException: Connection closed before full header was received") the call was to an https address using Microsoft Internet Information Services as backend, in the SSL settings of the website in IIS i had mistakenly set "Client certificates: Accept" instead of "Client certificates: Ignore", setting "Ignore" solved the problem.

luffy1012 commented 3 years ago

Same issue! changing https to http works, but it's not a good solution if you consider security! cached_network_image package works almost every time! It sucks that this issue is still not fixed after so many months!

juanektbb commented 3 years ago

Any clues for a proper solution for this issue? It seems to be important and changing to http is not ideal...

vijineyyal commented 3 years ago

i found a solution

On Mon, 14 Jun 2021 at 02:37, Juan D. Diaz @.***> wrote:

Any clues on a proper solution for this issue? It seems to be important.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/25107#issuecomment-860270174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALD6AJWRAEFZAM73FFZRNPDTSUMX3ANCNFSM4GJFKFXQ .

2math commented 3 years ago

i found a solution

Please share!

If is to change https to http, is not working all the time

vijineyyal commented 3 years ago

not that i created a different cachedimage viewer widget

On Mon, 14 Jun 2021 at 14:06, Galeen @.***> wrote:

i found a solution

Please share!

If is to change https to http, is not working all the time

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/25107#issuecomment-860501383, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALD6AJULRP7MPGQRKHZJKO3TSW5P3ANCNFSM4GJFKFXQ .

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.