So, I have to start theme to discuss this ANR. As I know, all Defold games now have this type of ANR. On Family Age project it is very critical for now, because we have around 1% ANR (with threshold ~0.47%). I want to discuss this, what we can do and that the problem.
I have the two types of ANR: (50% / 50%)
Input dispatching timed out (com.test.familyage/com.dynamo.android.DefoldActivity, Waiting to send key event because the focused window has not finished processing all of the input events that were previously delivered to it. Outbound queue length: 0. Wait queue length: 1.)
#00 pc 0000000000048218 /system/lib/libc.so (__epoll_pwait+20)
#01 pc 0000000000019ebd /system/lib/libc.so (epoll_pwait+60)
#02 pc 0000000000019eed /system/lib/libc.so (epoll_wait+12)
#03 pc 0000000000011dd7 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+118)
#04 pc 0000000000011cd3 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
#05 pc 0000000000092a7d /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
#06 pc 000000000064f5d5 /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+96)
at android.os.MessageQueue.nativePollOnce (Native method)
at android.os.MessageQueue.next (MessageQueue.java:323)
at android.os.Looper.loop (Looper.java:142)
at android.app.ActivityThread.main (ActivityThread.java:6393)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:823)
Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 14. Wait queue head age: 10535.3ms.)
#00 pc 000000000004aad4 /system/lib/libc.so (__epoll_pwait+20)
#01 pc 000000000001b74d /system/lib/libc.so (epoll_pwait+60)
#02 pc 000000000001b77d /system/lib/libc.so (epoll_wait+12)
#03 pc 0000000000010035 /system/lib/libutils.so (android::Looper::pollInner(int)+120)
#04 pc 000000000000ff25 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+32)
#05 pc 00000000000b5fe9 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, _jobject*, int)+24)
#06 pc 0000000000191155 /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+92)
at android.os.MessageQueue.nativePollOnce (Native method)
at android.os.MessageQueue.next (MessageQueue.java:325)
at android.os.Looper.loop (Looper.java:142)
at android.app.ActivityThread.main (ActivityThread.java:6651)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)
For last time I did try next next things to reduce amount of this ANRs:
- Test without NE (Find only the ANR belong to Ads NE)
- Compress sounds size. No effect.
- Removed one 4x4 atlas and one 4x2. For now in game I have one or two 4x2 atlas and other atlasses are 2x2. No effect.
- Async loading of main collection, using monarch, using flow. Optimized loading of resource files. No effect.
- Separate GUI windows to other collections to async load them. (Reduced resource loading on main collection). No effect.
- Finded the json decode performance bug. We implemented own NE to encode/decode JSON. No effect. But bug was fixed - this is nice moment
All of this have no affect to ANR count. Next question is what I can do to reduce ANR from my side? What I can help to Defold Team to reduce it or find the problem?
Note, what I always use newest defold version
Can you tell, if you have the same ANR problem and percentage? On differents projects it have different value, so seems what it is depends from the client game code. Trying to find where it is, but failed
So, let’s discuss what we can do?