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

skia - decoder->decode returned false #449

Closed
aemxn opened this issue Mar 20, 2014 · 6 comments
Closed

skia - decoder->decode returned false #449

aemxn opened this issue Mar 20, 2014 · 6 comments

Comments

@aemxn
Copy link

aemxn commented Mar 20, 2014

I'm having trouble when loading image from URL and drawable folder. Image in drawable is in JPG format and is around 162KB in size.

I noticed this happen when I visit the fragment that holds the ImageView for the second time. Means that the first time I visit the fragment, it successfully load the image (from url and drawable).

I'm thinking of memory heap issues are playing around here.

Here is how I implemented the Picasso (from drawable):

ImageView splash = (ImageView) findViewById(R.id.imgLogo);
Picasso.with(this).load(R.drawable.res_about).skipMemoryCache().into(splash);

LOGCAT

If loaded from a URL, I got this errors in logcat:

03-20 18:43:57.827    9943-9983/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 2456K, 23% free 35392K/45380K, paused 48ms, total 49ms
03-20 18:43:57.835    9943-9983/kedai.ma.app I/dalvikvm-heap﹕ Grow heap (frag case) to 37.903MB for 2795536-byte allocation
03-20 18:43:57.897    9943-9945/kedai.ma.app D/dalvikvm﹕ GC_CONCURRENT freed 19K, 17% free 38104K/45380K, paused 6ms+10ms, total 60ms
03-20 18:43:57.968    9943-9983/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 17% free 38103K/45380K, paused 39ms, total 39ms
03-20 18:43:57.968    9943-9983/kedai.ma.app I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 6289936-byte allocation
03-20 18:43:58.007    9943-9983/kedai.ma.app D/dalvikvm﹕ GC_BEFORE_OOM freed 1K, 17% free 38101K/45380K, paused 37ms, total 38ms
03-20 18:43:58.007    9943-9983/kedai.ma.app E/dalvikvm-heap﹕ Out of memory on a 6289936-byte allocation.
03-20 18:43:58.007    9943-9983/kedai.ma.app I/dalvikvm﹕ "Picasso-7f02009f" prio=5 tid=32 RUNNABLE
03-20 18:43:58.007    9943-9983/kedai.ma.app I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x412da910 self=0x518182c0
03-20 18:43:58.007    9943-9983/kedai.ma.app I/dalvikvm﹕ | sysTid=9983 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1367443216
03-20 18:43:58.007    9943-9983/kedai.ma.app I/dalvikvm﹕ | state=R schedstat=( 243865964 141235356 292 ) utm=21 stm=3 core=1
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #00  pc 000012a0  /system/lib/libcorkscrew.so (unwind_backtrace_thread+27)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #01  pc 0005fb74  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+35)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #02  pc 000539ca  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+313)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #03  pc 00053a72  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #04  pc 0002a26c  /system/lib/libdvm.so (dvmMalloc(unsigned int, int)+384)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #05  pc 00067cb8  /system/lib/libdvm.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #06  pc 00049712  /system/lib/libdvm.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #07  pc 0006da8c  /system/lib/libandroid_runtime.so (GraphicsJNI::allocateJavaPixelRef(_JNIEnv*, SkBitmap*, SkColorTable*)+127)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #08  pc 0006dab2  /system/lib/libandroid_runtime.so (JavaPixelAllocator::allocPixelRef(SkBitmap*, SkColorTable*)+17)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #09  pc 0004a004  /system/lib/libskia.so (SkBitmap::allocPixels(SkBitmap::Allocator*, SkColorTable*)+56)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #10  pc 0006ab72  /system/lib/libandroid_runtime.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #11  pc 0006af4e  /system/lib/libandroid_runtime.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #12  pc 0001e490  /system/lib/libdvm.so (dvmPlatformInvoke+112)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #13  pc 0004d26c  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+395)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #14  pc 000278a0  /system/lib/libdvm.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #15  pc 0002b7d8  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+176)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #16  pc 0005faa0  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+271)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #17  pc 0005faca  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+19)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #18  pc 0005462a  /system/lib/libdvm.so
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #19  pc 0000e418  /system/lib/libc.so (__thread_entry+72)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ #20  pc 0000db08  /system/lib/libc.so (pthread_create+168)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:378)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.ResourceBitmapHunter.decodeResource(ResourceBitmapHunter.java:52)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.ResourceBitmapHunter.decode(ResourceBitmapHunter.java:38)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:123)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:83)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at java.lang.Thread.run(Thread.java:856)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:306)
03-20 18:43:58.139    9943-9983/kedai.ma.app I/dalvikvm﹕ [ 03-20 18:43:58.147  9943: 9983 D/skia     ]
    --- allocation failed for scaled bitmap
03-20 18:43:58.405    9943-9943/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 2736K, 20% free 36399K/45380K, paused 26ms, total 26ms
03-20 18:43:58.405    9943-9943/kedai.ma.app I/dalvikvm-heap﹕ Grow heap (frag case) to 38.470MB for 2359312-byte allocation
03-20 18:43:58.452    9943-9945/kedai.ma.app D/dalvikvm﹕ GC_CONCURRENT freed <1K, 15% free 38703K/45380K, paused 3ms+8ms, total 47ms```


And from drawable, I got this error in logcat:


```03-20 18:44:52.538    9943-9943/kedai.ma.app D/dalvikvm﹕ GC_EXPLICIT freed 1064K, 17% free 37693K/45380K, paused 4ms+6ms, total 56ms
03-20 18:44:53.124    9943-9945/kedai.ma.app D/dalvikvm﹕ GC_CONCURRENT freed 3419K, 20% free 36321K/45380K, paused 3ms+5ms, total 47ms
03-20 18:44:53.124   9943-10174/kedai.ma.app D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 28ms
03-20 18:44:53.124   9943-10183/kedai.ma.app D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 33ms
03-20 18:44:53.241    9943-9943/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 1198K, 21% free 36265K/45380K, paused 30ms, total 31ms
03-20 18:44:53.428    9943-9982/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 897K, 19% free 37191K/45380K, paused 27ms, total 27ms
03-20 18:44:53.428    9943-9982/kedai.ma.app I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 7774224-byte allocation
03-20 18:44:53.460    9943-9982/kedai.ma.app D/dalvikvm﹕ GC_BEFORE_OOM freed 1K, 19% free 37189K/45380K, paused 36ms, total 36ms
03-20 18:44:53.460    9943-9982/kedai.ma.app E/dalvikvm-heap﹕ Out of memory on a 7774224-byte allocation.
03-20 18:44:53.460    9943-9982/kedai.ma.app I/dalvikvm﹕ "Picasso-/uploads/canvas/211_canvas.jpg" prio=5 tid=31 RUNNABLE
03-20 18:44:53.460    9943-9982/kedai.ma.app I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x4107fc10 self=0x517262f8
03-20 18:44:53.460    9943-9982/kedai.ma.app I/dalvikvm﹕ | sysTid=9982 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1366452040
03-20 18:44:53.460    9943-9982/kedai.ma.app I/dalvikvm﹕ | state=R schedstat=( 331451407 199340829 336 ) utm=28 stm=3 core=1
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #00  pc 000012a0  /system/lib/libcorkscrew.so (unwind_backtrace_thread+27)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #01  pc 0005fb74  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+35)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #02  pc 000539ca  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+313)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #03  pc 00053a72  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #04  pc 0002a26c  /system/lib/libdvm.so (dvmMalloc(unsigned int, int)+384)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #05  pc 00067cb8  /system/lib/libdvm.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #06  pc 00049712  /system/lib/libdvm.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #07  pc 0006da8c  /system/lib/libandroid_runtime.so (GraphicsJNI::allocateJavaPixelRef(_JNIEnv*, SkBitmap*, SkColorTable*)+127)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #08  pc 0006dab2  /system/lib/libandroid_runtime.so (JavaPixelAllocator::allocPixelRef(SkBitmap*, SkColorTable*)+17)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #09  pc 0004a004  /system/lib/libskia.so (SkBitmap::allocPixels(SkBitmap::Allocator*, SkColorTable*)+56)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #10  pc 000b4de4  /system/lib/libskia.so (SkJPEGImageDecoder::onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode)+872)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #11  pc 000b2ba8  /system/lib/libskia.so (SkImageDecoder::decode(SkStream*, SkBitmap*, SkBitmap::Config, SkImageDecoder::Mode, bool)+172)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #12  pc 0006a97a  /system/lib/libandroid_runtime.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #13  pc 0006b0a2  /system/lib/libandroid_runtime.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #14  pc 0001e490  /system/lib/libdvm.so (dvmPlatformInvoke+112)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #15  pc 0004d26c  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+395)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #16  pc 000278a0  /system/lib/libdvm.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #17  pc 0002b7d8  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+176)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #18  pc 0005faa0  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+271)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #19  pc 0005faca  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+19)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #20  pc 0005462a  /system/lib/libdvm.so
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #21  pc 0000e418  /system/lib/libc.so (__thread_entry+72)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ #22  pc 0000db08  /system/lib/libc.so (pthread_create+168)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:529)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.NetworkBitmapHunter.decodeStream(NetworkBitmapHunter.java:108)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.NetworkBitmapHunter.decode(NetworkBitmapHunter.java:60)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:123)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:83)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at java.lang.Thread.run(Thread.java:856)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:306)
03-20 18:44:53.475    9943-9982/kedai.ma.app I/dalvikvm﹕ [ 03-20 18:44:53.475  9943: 9982 D/skia     ]
    --- decoder->decode returned false
03-20 18:44:53.546    9943-9943/kedai.ma.app D/dalvikvm﹕ GC_FOR_ALLOC freed 88K, 16% free 38134K/45380K, paused 26ms, total 26ms
03-20 18:44:53.553    9943-9943/kedai.ma.app I/dalvikvm-heap﹕ Grow heap (frag case) to 40.164MB for 2359312-byte allocation
03-20 18:44:53.593    9943-9945/kedai.ma.app D/dalvikvm﹕ GC_CONCURRENT freed 3K, 11% free 40438K/45380K, paused 3ms+6ms, total 39ms
03-20 18:44:53.843    9943-9950/kedai.ma.app I/dalvikvm﹕ Jit: resizing JitTable from 4096 to 8192

I've noticed there is already an issue tracked here #281. I'm using the latest Picasso package which includes the Pull Request #285. But still the problem persists. Is there something I missed?

@crossle
Copy link

crossle commented May 6, 2014

same issue.

@JakeWharton
Copy link
Collaborator

Everything is in these two lines:

D/dalvikvm﹕ GC_BEFORE_OOM freed 1K, 17% free 38101K/45380K, paused 37ms, total 38ms
E/dalvikvm-heap﹕ Out of memory on a 6289936-byte allocation.

The decode of the 126K image requires 6,143K on the heap and only have 7,279K free.

Use smaller images, RGB_565, and/or include .fit() to reduce memory. There's nothing we can really do here.

@crossle
Copy link

crossle commented May 6, 2014

This is my log, try use .fit(), but failed.

     EsApplication  I  Trimming memory (onTrimMemory 5)
     ThumbnailCache  W  Low Memory: Freed 0 resources from compression queue, 0 from write queue, 0 from the pinned list, 0 from the cache.
     ManagedEGLContext  W  doTerminate failed: EGL count is 2 but managed count is 1

        System.err  W  java.net.SocketTimeoutException: Read timed out
                    W      at com.squareup.okhttp.internal.spdy.SpdyStream$SpdyDataSource.waitUntilReadable(SpdyStream.java:417)
                    W      at com.squareup.okhttp.internal.spdy.SpdyStream$SpdyDataSource.read(SpdyStream.java:368)
                    W      at com.squareup.okhttp.internal.http.SpdyTransport$SpdySource.read(SpdyTransport.java:268)
                    W      at com.squareup.okhttp.internal.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
                    W      at java.io.InputStream.read(InputStream.java:162)
                    W      at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
                    W      at java.io.BufferedInputStream.read(BufferedInputStream.java:288)
                    W      at com.squareup.picasso.MarkableInputStream.read(MarkableInputStream.java:138)
                    W      at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
                    W      at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:613)
                    W      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:589)
                    W      at com.squareup.picasso.NetworkBitmapHunter.decodeStream(NetworkBitmapHunter.java:108)
                    W      at com.squareup.picasso.NetworkBitmapHunter.decode(NetworkBitmapHunter.java:60)
                    W      at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:123)
                    W      at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:83)
                    W      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                    W      at java.util.concurrent.FutureTask.run(FutureTask.java:237)

                    W      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                    W      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                    W      at java.lang.Thread.run(Thread.java:841)

                       Process 26419 is found


                       Process 26417 is deleted

                    W      at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:306)
              skia  D  ---- read threw an exception
                    D  --- decoder->decode returned false/

@JakeWharton
Copy link
Collaborator

@crossle That would be a network timeout.

@crossle
Copy link

crossle commented May 6, 2014

I use the icon form avatar, every time and time out, never sucess.
Maybe our server pic so big...
Thanks.

@dnkoutso
Copy link
Collaborator

Closing.

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

4 participants