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

Native crash playing Gifs #219

Closed
sjudd opened this issue Oct 27, 2014 · 8 comments
Closed

Native crash playing Gifs #219

sjudd opened this issue Oct 27, 2014 · 8 comments

Comments

@sjudd
Copy link
Collaborator

sjudd commented Oct 27, 2014

We seem to have a problem drawing Bitmaps that are either recycled or being modified concurrently. As far as I can tell this crash was introduced here: 32f7a82.

For 3.4 I'll stick with reverting that change. However, I don't believe the change itself is incorrect, so there's likely something wrong in GifDrawable. I'll target the subsequent fix for 3.5 and/or a dot release.

F/libc    ( 7348): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 7348 (e.samples.giphy)
I/DEBUG   (  178): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  178): Build fingerprint: 'google/hammerhead/hammerhead:4.4.2/KOT50E/1079831:userdebug/dev-keys'
I/DEBUG   (  178): Revision: '11'
I/DEBUG   (  178): pid: 7348, tid: 7348, name: e.samples.giphy  >>> com.bumptech.glide.samples.giphy <<<
I/DEBUG   (  178): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000

I/DEBUG   (  178): backtrace:
I/DEBUG   (  178):     #00  pc 000290ba  /system/lib/libhwui.so (android::uirenderer::ResourceCache::decrementRefcountLocked(SkBitmap*)+7)
I/DEBUG   (  178):     #01  pc 00012d9b  /system/lib/libhwui.so
I/DEBUG   (  178):     #02  pc 00012fd1  /system/lib/libhwui.so
I/DEBUG   (  178):     #03  pc 000174f7  /system/lib/libhwui.so (android::uirenderer::DisplayListRenderer::getDisplayList(android::uirenderer::DisplayList*)+32)
I/DEBUG   (  178):     #04  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
I/DEBUG   (  178):     #05  pc 0004e123  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
I/DEBUG   (  178):     #06  pc 00026fe0  /system/lib/libdvm.so
I/DEBUG   (  178):     #07  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
I/DEBUG   (  178):     #08  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
I/DEBUG   (  178):     #09  pc 00060865  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
I/DEBUG   (  178):     #10  pc 000687c7  /system/lib/libdvm.so
I/DEBUG   (  178):     #11  pc 00026fe0  /system/lib/libdvm.so
I/DEBUG   (  178):     #12  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
I/DEBUG   (  178):     #13  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
I/DEBUG   (  178):     #14  pc 00060581  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
I/DEBUG   (  178):     #15  pc 00049d0b  /system/lib/libdvm.so
I/DEBUG   (  178):     #16  pc 0004cde7  /system/lib/libandroid_runtime.so
I/DEBUG   (  178):     #17  pc 0004db0b  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354)
I/DEBUG   (  178):     #18  pc 0000105b  /system/bin/app_process
I/DEBUG   (  178):     #19  pc 0000e34b  /system/lib/libc.so (__libc_init+50)
I/DEBUG   (  178):     #20  pc 00000d7c  /system/bin/app_process
I/DEBUG   (  178): 
@sjudd sjudd added the bug label Oct 27, 2014
@sjudd sjudd self-assigned this Oct 27, 2014
@sjudd sjudd modified the milestone: 3.4 Oct 27, 2014
sjudd added a commit to sjudd/glide that referenced this issue Oct 28, 2014
@sjudd sjudd modified the milestones: 3.5, 3.4 Oct 29, 2014
@sjudd
Copy link
Collaborator Author

sjudd commented Oct 29, 2014

Fixed for 3.4, moving to 3.5 to find the real cause.

@jisung
Copy link
Contributor

jisung commented Apr 14, 2015

Our app in production also has the same issue. we uses glide:3.5.2 + okhttp-integration:1.2.2 combo.
Is there any workaround to avoid this issue for now?

@sjudd
Copy link
Collaborator Author

sjudd commented Jun 9, 2015

Ok so after some discussion, this happens because the framework doesn't expect us to reconfigure Bitmaps until after it has finished drawing them. The only way to guarantee that we do so is to delay calling reconfigure by posting to a Handler before returning the Bitmaps to the pool. This is what the warning at the bottom of the javadoc for reconfigure() is referring to.

Since we're doing this for GIFs, this particular issue should be fixed. We don't do this generally, so it's still possible this could randomly crop up when loading other types of images. We should look in to posting all returns, not just those for GIFs.

@BHsueh
Copy link

BHsueh commented Sep 10, 2015

Hi,
We are seeing this issue when our app plays gifs with glide 3.6 on Samsung I9500 + Android 4.4.2. We can see that the milestone for this issue is 4.0. Before that, is there any workaround we can use? We need to release our app recently. Please give some advice.

Thanks a lot.

@sjudd
Copy link
Collaborator Author

sjudd commented Jan 28, 2016

If this is still affecting people, I don't have any great ideas. If you can provide a sample app and a new stack trace I can look in to it more.

@sjudd sjudd removed their assignment Jan 28, 2016
@sjudd sjudd closed this as completed Jan 28, 2016
@kiaanpillay
Copy link

I have this same error when working with GIFs

@TWiStErRob
Copy link
Collaborator

@kiaanpillay without a consistent repro we can't do much: #219 (comment)

@petrovichtim
Copy link

petrovichtim commented Nov 10, 2016

I got same error on Android 4.4 Galaxy Core2 (kanas)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/kanas3gxx/kanas:4.4.2/KOT49H/G355HXXU0APG2:user/release-keys'
Revision: '5'
pid: 20100, tid: 20100, name: sdelphi.catlist  >>> com.rusdelphi.catlist <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    r0 00000000  r1 56e3a000  r2 56f5b740  r3 00000000
    r4 56e3a000  r5 56f6fab0  r6 00000000  r7 4171b1b0
    r8 bebdf390  r9 4171b1a8  sl 4178f740  fp bebdf3a4
    ip 40c9ea88  sp bebdf328  lr 40c78efd  pc 40c8f8ca  cpsr 800e0030
    d0  4303000000000000  d1  436a00003f000000
    d2  43030000436a8000  d3  436a90cb43038000
    d4  3f80000043030000  d5  436a000043030000
    d6  3f800000436a0000  d7  436a000000000000
    d8  3f800000427c7e4b  d9  406d5000000000ea
    d10 0000000000000000  d11 0000000000000000
    d12 0000000000000000  d13 0000000000000000
    d14 0000000000000000  d15 0000000000000000
    d16 3fef84cfe0000000  d17 0000000000000000
    d18 3fef84cfe0000000  d19 0000000000000000
    d20 3ff0000000000000  d21 3ffc268000000000
    d22 0000000000000000  d23 0000000000000000
    d24 3fef84cfe0000000  d25 0000000000000000
    d26 3ff0000000000000  d27 0000000000000000
    d28 3fef84cfe0000000  d29 0000000000000000
    d30 ffffffffffffffff  d31 0000000000000000
    scr 80000010

backtrace:
    #00  pc 0002a8ca  /system/lib/libhwui.so (android::uirenderer::ResourceCache::decrementRefcountLocked(SkBitmap*)+7)
    #01  pc 00013ef9  /system/lib/libhwui.so
    #02  pc 00014131  /system/lib/libhwui.so
    #03  pc 0001867b  /system/lib/libhwui.so (android::uirenderer::DisplayListRenderer::getDisplayList(android::uirenderer::DisplayList*)+32)
    #04  pc 0001dd4c  /system/lib/libdvm.so (dvmPlatformInvoke+112)
    #05  pc 0004e213  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
    #06  pc 00027160  /system/lib/libdvm.so
    #07  pc 0002e110  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
    #08  pc 0002b7bc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #09  pc 00060919  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
    #10  pc 000688ab  /system/lib/libdvm.so
    #11  pc 00027160  /system/lib/libdvm.so
    #12  pc 0002e110  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
    #13  pc 0002b7bc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #14  pc 00060637  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+338)
    #15  pc 00049dfb  /system/lib/libdvm.so
    #16  pc 00055417  /system/lib/libandroid_runtime.so
    #17  pc 000569af  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*, bool)+358)
    #18  pc 00001063  /system/bin/app_process
    #19  pc 0000e433  /system/lib/libc.so (__libc_init+50)
    #20  pc 00000d80  /system/bin/app_process

code around pc:
    40c8f8a8 4605b538 460c6888 f7ffb108 4628fdfa  
    40c8f8b8 e8bd4621 f7ff4038 b538bfcb 68484605  
    40c8f8c8 6802460c 47886a11 b1086960 fde9f7ff  
    40c8f8d8 46214628 4038e8bd bfbaf7ff 4605b573  
    40c8f8e8 ac02460e 0d04f844 fe3ff7e3 46314628  
    40c8f8f8 ffaef7ff f7e34620 bd7cfe31 bfeef7ff  
    40c8f908 4605b538 460c68c8 f7ffb108 4628fdca  
    40c8f918 e8bd4621 f7ff4038 b538bfe1 68884605  
    40c8f928 b108460c fdbdf7ff 46214628 4038e8bd  
    40c8f938 bfd4f7ff 4605b538 460c6848 6a116802  
    40c8f948 69604788 f7ffb108 4628fdac e8bd4621  
    40c8f958 f7ff4038 b538bfc3 68404605 f7ff460c  
    40c8f968 2800fd98 686bdb05 eb016859 684200c0  
    40c8f978 f7e8b97a b130f9e3 ff26f7e5 f5004621  
    40c8f988 f7fa70a4 b174fca1 e8bd4620 f0044038  
    40c8f998 6811bc39 71532301 4628b929 e8bd4621  

code around lr:
    40c78edc 10e8f8d4 75e8f505 ff14f7fe f0164628  
    40c78eec e006fb44 46286862 1026f852 fce3f016  
    40c78efc 68a03601 d3f54286 e00b2600 462869a7  
    40c78f0c 7026f857 46393601 fcd5f016 46394628  
    40c78f1c fd58f016 428e69e1 2600d3f0 6ae1e006  
    40c78f2c f8514628 f0161026 3601fcac 42966b22  
    40c78f3c 2600d3f5 6c23e006 f8534628 f0161026  
    40c78f4c 3601fc9e 429e6c63 2600d3f5 f8d4e00e  
    40c78f5c 462810b8 1026f851 fca0f016 20b8f8d4  
    40c78f6c f8524628 f0161026 3601fc42 00bcf8d4  
    40c78f7c d3ec4286 e0062600 46286fe3 1026f853  
    40c78f8c fc7df016 f8d43601 428e1080 2600d3f4  
    40c78f9c f8d4e007 462820cc 1026f852 fc6ff016  
    40c78fac f8d43601 429620d0 4628d3f3 fadff016  
    40c78fbc e00a2500 f8516d61 b12e6025 f7f94630  
    40c78fcc 4630ebac efd6f7f8 6da33501 d3f1429d  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants