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

LruCache.sizeOf() is reporting inconsistent results #865

Closed
jaydp17 opened this issue Feb 4, 2015 · 3 comments · Fixed by #866
Closed

LruCache.sizeOf() is reporting inconsistent results #865

jaydp17 opened this issue Feb 4, 2015 · 3 comments · Fixed by #866
Milestone

Comments

@jaydp17
Copy link

jaydp17 commented Feb 4, 2015

Here's a simple code that reproduces the error.

Activity and xml

Here's how to reproduce it:

Steps:

  1. click Load
  2. click Invalidate
  3. goto Step 1 (repeat a couple of time)

Here's the error I get.

java.lang.IllegalStateException: com.squareup.picasso.LruCache.sizeOf() is reporting inconsistent results!
            at com.squareup.picasso.LruCache.trimToSize(LruCache.java:94)
            at com.squareup.picasso.LruCache.set(LruCache.java:84)
            at com.squareup.picasso.Dispatcher.performComplete(Dispatcher.java:369)
            at com.squareup.picasso.Dispatcher$DispatcherHandler.handleMessage(Dispatcher.java:501)

P.S. I'm using Sonatype's snapshot v2.4.1

@dnkoutso
Copy link
Collaborator

dnkoutso commented Feb 4, 2015

Thanks for the report. PR is up with the fix.

@justintoth
Copy link

3 years later, this is still happening.

Image loading failed: http://rprimage.realestatedigital.com/ListingImages/flmfr-n1b/addl_picts/1756/0/T2868833-24.jpg?201703311054
Java.Lang.IllegalStateException: md59cd5ae6924ea1865908f6a4eed48fb35.LRUCache.sizeOf() is reporting inconsistent results!
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in :0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in :0
at Android.Util.LruCache.Put (Java.Lang.Object key, Java.Lang.Object value) [0x00043] in <848bbd7c681a4975918c72f17d2f5144>:0
at FFImageLoading.Cache.ByteBoundStrongLruCache1[TValue].Add (System.String key, TValue value) [0x00011] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Cache\ByteBoundStrongLruCache.cs:67 at FFImageLoading.Cache.ReuseBitmapDrawableCache1[TValue].PromoteReuseEntryToDisplayedCache (TValue value) [0x0006e] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Cache\ReuseBitmapDrawableCache.cs:294
at FFImageLoading.Cache.ReuseBitmapDrawableCache1[TValue].OnEntryDisplayed (System.Object sender, System.EventArgs args) [0x00025] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Cache\ReuseBitmapDrawableCache.cs:267 at FFImageLoading.Drawables.SelfDisposingBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed) [0x00075] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Drawables\SelfDisposingBitmapDrawable.cs:151 at FFImageLoading.Drawables.FFBitmapDrawable.SetIsDisplayed (System.Boolean isDisplayed) [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Drawables\FFBitmapDrawable.cs:78 at FFImageLoading.Views.ManagedImageView.UpdateDrawableDisplayedState (Android.Graphics.Drawables.Drawable drawable, System.Boolean isDisplayed) [0x00028] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Views\ManagedImageView.cs:205 at FFImageLoading.Views.ManagedImageView.SetImageDrawable (Android.Graphics.Drawables.Drawable drawable) [0x00092] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Views\ManagedImageView.cs:168 at FFImageLoading.Targets.ImageViewTarget.Set (FFImageLoading.Work.IImageLoaderTask task, FFImageLoading.Drawables.SelfDisposingBitmapDrawable image, System.Boolean animated) [0x00020] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Targets\ImageViewTarget.cs:48 at FFImageLoading.PlatformImageLoaderTask1+<>c__DisplayClass5_0[TImageView].b__0 () [0x0000b] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Work\PlatformImageLoadingTask.cs:89
at FFImageLoading.Helpers.MainThreadDispatcher+<>c__DisplayClass2_0.b__0 () [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Helpers\MainThreadDispatcher.cs:32
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
at FFImageLoading.PlatformImageLoaderTask1+<SetTargetAsync>d__5[TImageView].MoveNext () [0x0017c] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Work\PlatformImageLoadingTask.cs:85 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 at FFImageLoading.Work.ImageLoaderTask3+d__108[TDecoderContainer,TImageContainer,TImageView].MoveNext () [0x005e9] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:571
--- End of managed Java.Lang.IllegalStateException stack trace ---
java.lang.IllegalStateException: md59cd5ae6924ea1865908f6a4eed48fb35.LRUCache.sizeOf() is reporting inconsistent results!
at android.util.LruCache.trimToSize(LruCache.java:200)
at android.util.LruCache.put(LruCache.java:183)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

@NightlyNexus
Copy link
Contributor

@justintoth Are you calling Bitmap.recycle() on any Bitmaps in your cache?
It could be #1693.

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

Successfully merging a pull request may close this issue.

4 participants