Closed pawan52tiwari closed 2 years ago
there are lot ANR crash happening due to this
DALVIK THREADS (199):
"main" prio=5 tid=1 Suspended
| group="main" sCount=1 dsCount=0 obj=0x7444d000 self=0xb6ff6e98
| sysTid=14608 nice=-4 cgrp=default sched=0/0 handle=0xb6fc7000
| state=S schedstat=( 359300372112 84333204824 721701 ) utm=27185 stm=8745 core=2 HZ=100
| stack=0xbe1db000-0xbe1dd000 stackSize=8MB
| held mutexes=
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:178)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:779)
at android.view.Choreographer.doCallbacks(Choreographer.java:592)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:767)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5604)
at java.lang.reflect.Method.invoke!(Native method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
"glide-disk-cache-thread-0" prio=5 tid=64 Blocked
| group="main" sCount=1 dsCount=0 obj=0x132d4940 self=0xb735a078
| sysTid=14912 nice=9 cgrp=default sched=0/0 handle=0xb7693160
| state=S schedstat=( 4972521855 20263114853 10607 ) utm=385 stm=112 core=3 HZ=100
| stack=0x8b850000-0x8b852000 stackSize=1036KB
| held mutexes=
at com.bumptech.glide.disklrucache.DiskLruCache.get(DiskLruCache.java:-1)
- waiting to lock <0x260b05cb> (a com.bumptech.glide.disklrucache.DiskLruCache) held by thread 95
at com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper.get(DiskLruCacheWrapper.java:94)
at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:85)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:276)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
"glide-source-thread-0" prio=5 tid=95 Native
| group="main" sCount=1 dsCount=0 obj=0x13c5a460 self=0xb76e6c38
| sysTid=14943 nice=9 cgrp=default sched=0/0 handle=0xb76e68a0
| state=S schedstat=( 1612669901 5220033107 3533 ) utm=128 stm=33 core=0 HZ=100
| stack=0x8afaf000-0x8afb1000 stackSize=1036KB
| held mutexes=
kernel: (couldn't read /proc/self/task/14943/stack)
native: #00 pc 00012ac0 /system/lib/libc.so (syscall+28)
native: #01 pc 000a98af /system/lib/libart.so (_ZN3art17ConditionVariable4WaitEPNS_6ThreadE+82)
native: #02 pc 001c1529 /system/lib/libart.so (_ZN3art3JNI17GetStringUTFCharsEP7_JNIEnvP8_jstringPh+672)
native: #03 pc 000139eb /system/lib/libjavacore.so (???)
native: #04 pc 000211db /system/lib/libjavacore.so (???)
native: #05 pc 0009c2a7 /system/framework/arm/boot.oat (Java_libcore_io_Posix_access__Ljava_lang_String_2I+106)
at libcore.io.Posix.access(Native method)
at libcore.io.BlockGuardOs.access(BlockGuardOs.java:68)
at java.io.File.doAccess(File.java:283)
at java.io.File.exists(File.java:363)
at com.bumptech.glide.disklrucache.DiskLruCache$Editor.getFile(DiskLruCache.java:807)
- locked <0x260b05cb> (a com.bumptech.glide.disklrucache.DiskLruCache)
at com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper.put(DiskLruCacheWrapper.java:130)
at com.bumptech.glide.load.engine.SourceGenerator.cacheData(SourceGenerator.java:108)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:47)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
Glide's threads being blocked should never cause an ANR, unless you've deliberately blocked the main thread while waiting for an image load. Glide tries to prevent this via assertions, but it is possible to workaround it. In the above stack traces I don't see the main thread being blocked on Glide. So there's another cause for the ANR.
It does look like Glide's threads are blocked trying to make a system call to access a File. That is normally quite fast, which suggests something wrong with the device or sdcard.
I am using Glide in android tv app. We are using react native which is using the fast image that also usage the Glide. And android native is also using the Glide. But we are seeing lot of ANRs In ANR dump mostly Glide threads are blocked.
Example
Is something wrong with the way we could be using the Glide between React native and Native.