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

Cached images stop working after cache expiration time #29

Closed
volgin opened this issue Apr 9, 2018 · 7 comments
Closed

Cached images stop working after cache expiration time #29

volgin opened this issue Apr 9, 2018 · 7 comments

Comments

@volgin
Copy link

volgin commented Apr 9, 2018

After about 24 hours Cached images with Google cloud storage URLs start throwing this error:

Failed assertion: line 362 pos 12: '_codec != null': is not true.

I tried to comment out this line of code in flutter_cache_manager.dart:

if (eTag != null) { // headers["If-None-Match"] = eTag; }

and it solved the problem

@renefloor
Copy link
Collaborator

Could you turn on debug logging with CacheManager.showDebugLogs = true; and give me the logs? Could you also give me the image url, maybe I can try to replicate it.

@volgin
Copy link
Author

volgin commented Apr 9, 2018

Everything works until cache expires:

I/flutter (18997): [Flutter Cache Manager] Loading https://lh3.googleusercontent.com/d3JHYHTB4M7Hubtt_ZBXb238BYr1teMd8cwl7Yb_3edLoR5vij-ih51U-KZztbwh_-3r1IWQNzqHAO_CbaYn3FG-PNQ=s94
I/flutter (18997): Using file from cache.
I/flutter (18997): Cache valid till 2018-04-10T16:19:04.976
I/flutter (18997): [Flutter Cache Manager] Loading https://lh3.googleusercontent.com/IjfUqu_Ynxlj16WGbKR0aBDaFsQ5UN_nzs1Wo16t9PSksvtIflbrprfoZW_ze_rfdcjyEE6U0EBz_ELmmcuyXCBMd7I=s94
I/flutter (18997): Using file from cache.
I/flutter (18997): Cache valid till 2018-04-10T16:19:04.669
I/flutter (18997): [Flutter Cache Manager] Loading https://lh3.googleusercontent.com/Hjwzysnfpk2ZRecZbncvLjI6ahdXPY53FQ_cvHl46j92MiutKkad73P3m-MlHQlPVuYooQUm1aZE_LDG1cyY1DsCs1E=s94
I/flutter (18997): Using file from cache.
I/flutter (18997): Cache valid till 2018-04-10T16:19:04.643

I will update when it expires and starts throwing errors again.

@volgin
Copy link
Author

volgin commented Apr 10, 2018

Here we go. Note that there are no debug messages even though showDebugLogs = true.

I/flutter (13317): Show full size: https://lh3.googleusercontent.com/IjfUqu_Ynxlj16WGbKR0aBDaFsQ5UN_nzs1Wo16t9PSksvtIflbrprfoZW_ze_rfdcjyEE6U0EBz_ELmmcuyXCBMd7I=s1794
I/flutter (13317): Player init. Recording title: 
E/flutter (13317): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (13317): 'package:flutter/src/painting/image_stream.dart': Failed assertion: line 362 pos 12: '_codec != null': is not true.
E/flutter (13317): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
E/flutter (13317): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
E/flutter (13317): #2      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart)
E/flutter (13317): #3      _RootZone.runUnary (dart:async/zone.dart:1381:54)
E/flutter (13317): #4      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter (13317): #5      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:633:45)
E/flutter (13317): #6      Future._propagateToListeners (dart:async/future_impl.dart:662:32)
E/flutter (13317): #7      Future._completeError (dart:async/future_impl.dart:485:5)
E/flutter (13317): #8      _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)
E/flutter (13317): #9      _Completer.completeError (dart:async/future_impl.dart:27:5)
E/flutter (13317): #10     CachedNetworkImageProvider._loadAsync (package:cached_network_image/cached_network_image.dart)
E/flutter (13317): <asynchronous suspension>
E/flutter (13317): #11     CachedNetworkImageProvider.load (package:cached_network_image/cached_network_image.dart:457:16)
E/flutter (13317): #12     ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:86)
E/flutter (13317): #13     ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:82:22)
E/flutter (13317): #14     ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:265:63)
E/flutter (13317): #15     SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
E/flutter (13317): #16     ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:263:30)
E/flutter (13317): #17     DecorationImagePainter.paint (package:flutter/src/painting/decoration_image.dart:239:55)
E/flutter (13317): #18     _BoxDecorationPainter._paintBackgroundImage (package:flutter/src/painting/box_decoration.dart:397:19)
E/flutter (13317): #19     _BoxDecorationPainter.paint (package:flutter/src/painting/box_decoration.dart:415:5)
E/flutter (13317): #20     RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:1850:16)
E/flutter (13317): #21     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (13317): #22     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (13317): #23     _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2207:15)
E/flutter (13317): #24     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:593:5)
E/flutter (13317): #25     RenderStack.paint (package:flutter/src/rendering/stack.dart:601:7)
E/flutter (13317): #26     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (13317): #27     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (13317): #28     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:125:15)
E/flutter (13317): #29     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (13317): #30     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:11)
E/flutter (13317): #31     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:147:7)
E/flutter (13317): #32     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:128:7)
E/flutter (13317): #33     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:125:15)
E/flutter (13317): #34     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (13317): #35     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (13317): #36     RenderAnimatedOpacity.paint (package:flutter/src/rendering/proxy_box.dart:853:17)
E/flutter (13317): #37     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2018:7)
E/flutter (13317): #38     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:130:13)
E/flutter (13317): #39     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:125:15)
E/flutter (13317): #40     RenderFractionalTranslation.paint (package:flutter/src/rendering/proxy_box.d

@p30arena
Copy link

p30arena commented Apr 10, 2018

I think I'm having a similar issue, but after rebuilding the app it is gone.
I'll open an issue as soon as it happens again, with traces of course.
https://youtu.be/RoJFvuhxFh8

@volgin please wrap the logs and codes in the code markup, your'e referencing other issues unintentionally.

@renefloor
Copy link
Collaborator

Hmm.. It doesn't directly show something I can work with, but I'll dig into it. Are you using version 0.4.0-rc.1 of the library?

@volgin
Copy link
Author

volgin commented Apr 10, 2018

Yes, I am using 0.4.0-rc.1.

Again, I commented out line 249 in flutter_cache_manager.dart, and it solves the problem. I hope it helps. This is the output after this line is commented out:

I/flutter (18013): [Flutter Cache Manager] Loading https://lh3.googleusercontent.com/JFFfSuPRCOj8nNgy7o-_uJkeig4j_Zzq2Mr9Ogj45X5Hnjq_Qm-URWnTXkpgfk5m7EdpLN1d_tRLUcNhvo3GBeRjngc=s94
I/flutter (18013): Updating file in cache.
I/flutter (18013): New cache file valid till 2018-04-11T18:25:08.807

@renefloor renefloor added the bug label Apr 14, 2018
@renefloor
Copy link
Collaborator

@volgin there was indeed something wrong with the headers. It should now be working fine in version 0.4.0. Thanks for helping.

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

3 participants