Firebase cloud messagin causes ANR - android

I've an app in production with over 10k daily users
2% of the sessions are being reported as ANR due:
Broadcast of Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x11000010 pkg=com.tomatedigital.app
cmp=com.tomatedigital.app/com.google.firebase.iid.FirebaseInstanceIdReceiver (has extras) }
I've checked many sources nobody come with a real solution for that.
this link: https://github.com/firebase/quickstart-android/issues/594 starts with a good talking but as always firebase boys "burn out" and stop answering.
all the reports show something like:
"main" tid=1 Native
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x73be7718 self=0xeeaf7000
| sysTid=12027 nice=-4 cgrp=default sched=0/0 handle=0xf2fc54bc
| state=S schedstat=( 1058569940 1464725264 2305 ) utm=68 stm=37 core=2 HZ=100
| stack=0xff45f000-0xff461000 stackSize=8MB
| held mutexes=
#00 pc 000000000004a154 /system/lib/libc.so (__epoll_pwait+20)
#01 pc 000000000001b799 /system/lib/libc.so (epoll_pwait+60)
#02 pc 000000000001b7c9 /system/lib/libc.so (epoll_wait+12)
#03 pc 0000000000010343 /system/lib/libutils.so (android::Looper::pollInner(int)+118)
#04 pc 0000000000010235 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+32)
#05 pc 00000000000e10ed /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, _jobject*, int)+24)
#06 pc 00000000001a6aed /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+92)
at android.os.MessageQueue.nativePollOnce (MessageQueue.java)
at android.os.MessageQueue.next (MessageQueue.java:325)
at android.os.Looper.loop (Looper.java:142)
at android.app.ActivityThread.main (ActivityThread.java:6942)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
I'm really not sure what to do to solve it.
These are my firebase imports
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.google.firebase:firebase-database:19.5.0'
implementation 'com.google.firebase:firebase-auth:19.4.0'
implementation 'com.google.firebase:firebase-dynamic-links:19.1.1'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
implementation 'com.google.firebase:firebase-config:19.2.0'

Related

AppMeasurementInstallReferrerReceiver causes many ANR with FirebaseAnalytics

I recently updated to
implementation 'com.google.firebase:firebase-analytics:17.2.3'
which is adding AppMeasurementInstallReferrerReceiver to my app manifest.xml just like this https://developers.google.com/android/reference/com/google/android/gms/measurement/AppMeasurementInstallReferrerReceiver
Since then, I'm having a lot (almost 5 per hour) of :
Broadcast of Intent { act=com.android.vending.INSTALL_REFERRER flg=0x10 pkg=my.app
cmp=my.app/com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver (has extras) }
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x766f4ce8 self=0x7a52814c00
| sysTid=9106 nice=0 cgrp=default sched=0/0 handle=0x7ad934d560
| state=S schedstat=( 9992336593 1304413016 9382 ) utm=658 stm=341 core=0 HZ=100
| stack=0x7fd7055000-0x7fd7057000 stackSize=8MB
| held mutexes=
#00 pc 000000000007c600 /system/lib64/libc.so (__epoll_pwait+8)
#01 pc 0000000000014d48 /system/lib64/libutils.so (android::Looper::pollInner(int)+148)
#02 pc 0000000000014c18 /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
#03 pc 0000000000130028 /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
at android.os.MessageQueue.nativePollOnce (MessageQueue.java)
at android.os.MessageQueue.next (MessageQueue.java:326)
at android.os.Looper.loop (Looper.java:181)
at android.app.ActivityThread.main (ActivityThread.java:7094)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
Is there something I can do for it or should I just wait for an update from Firebase...

HeapTaskDaemon blocked ANR. Other threads seem to be in waiting state

We have an ANR where the HeapTaskDaemon is blocked and the main thread is waiting and not busy/blocked. There are no parts of our code in any of the threads. How to debug this ANR? From what I see there is no deadlock and nothing heavy is being done on the main thread.
It also doesn't seem to be a long running operation in an INTENT.
Any trips on understanding the ANR would be really helpful. Also what does HeapTaskDaemon waiting to lock unknown object mean ?
Here is the HeapTaskDaemon thread:
HeapTaskDaemon" daemon prio=5 tid=6 Blocked
| group="system" sCount=1 dsCount=0 flags=1 obj=0x140c0338 self=0xa41d1400
| sysTid=1239 nice=4 cgrp=default sched=0/0 handle=0x99e3b970
| state=S schedstat=( 0 0 0 ) utm=515 stm=86 core=1 HZ=100
| stack=0x99d39000-0x99d3b000 stackSize=1038KB
| held mutexes=
#00 pc 000000000001902c /system/lib/libc.so (syscall+28)
#01 pc 00000000000b7289 /system/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+88)
#02 pc 00000000001cc795 /system/lib/libart.so (art::gc::TaskProcessor::GetTask(art::Thread*)+284)
#03 pc 00000000001ccd75 /system/lib/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+44)
#04 pc 00000000000551e3 /system/framework/arm/boot-core-libart.oat (Java_dalvik_system_VMRuntime_runHeapTasks__+74)
at dalvik.system.VMRuntime.runHeapTasks (Native method)
- waiting to lock an unknown object
at java.lang.Daemons$HeapTaskDaemon.runInternal (Daemons.java:461)
at java.lang.Daemons$Daemon.run (Daemons.java:103)
at java.lang.Thread.run (Thread.java:764)
Main Thread:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x70cb3f08 self=0xac6a8000
| sysTid=1230 nice=-2 cgrp=default sched=0/0 handle=0xb07a64a4
| state=S schedstat=( 0 0 0 ) utm=2107 stm=662 core=1 HZ=100
| stack=0xbe6e0000-0xbe6e2000 stackSize=8MB
| held mutexes=
#00 pc 0000000000049658 /system/lib/libc.so (__epoll_pwait+20)
#01 pc 000000000001b7b5 /system/lib/libc.so (epoll_pwait+60)
#02 pc 000000000001b7e5 /system/lib/libc.so (epoll_wait+12)
#03 pc 000000000001008b /system/lib/libutils.so (android::Looper::pollInner(int)+118)
#04 pc 000000000000ff7d /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+32)
#05 pc 00000000000b2d0d /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, _jobject*, int)+24)
#06 pc 00000000000ba5d5 /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+92)
at android.os.MessageQueue.nativePollOnce (MessageQueue.java)
at android.os.MessageQueue.next (MessageQueue.java:325)
at android.os.Looper.loop (Looper.java:142)
at com.android.server.SystemServer.run (SystemServer.java:423)
at com.android.server.SystemServer.main (SystemServer.java:274)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:787)
The full ANR log is at https://pastebin.com/i4F4VgTS

How to trace back ANR when you cant even find any class path in logs?

Below is what I got in logs. Dont know what this logs means.
Input dispatching timed out (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.), VisibleToUser
"main" tid=1 Native
"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x73baef60 self=0xa6b12000 | sysTid=10645 nice=-10 cgrp=default sched=0/0 handle=0xaa7cd494 | state=S schedstat=( 1907040905 256895069 3521 ) utm=150 stm=39 core=7 HZ=100 | stack=0xbe50f000-0xbe511000 stackSize=8MB | held mutexes=
#00 pc 0000000000019d34 /system/lib/libc.so (syscall+28)
#01 pc 00000000000a6b6b /system/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+78)
#02 pc 000000000026a895 /system/lib/libart.so (art::JNI::CallObjectMethod(_JNIEnv*, _jobject*, _jmethodID*, ...)+352)
#03 pc 0000000000098825 /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+20)
#04 pc 00000000000327d9 /system/lib/libandroidfw.so (android::DisplayEventDispatcher::handleEvent(int, int, void*)+100)
#05 pc 000000000000f239 /system/lib/libutils.so (android::Looper::pollInner(int)+632)
#06 pc 000000000000ef43 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+26)
#07 pc 00000000000b8bdb /system/lib/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long long, int)+24)
at android.os.MessageQueue.nativePollOnce (Native method)
at android.os.MessageQueue.next (MessageQueue.java:326)
at android.os.Looper.loop (Looper.java:169)
at android.app.ActivityThread.main (ActivityThread.java:6939)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:870)

ANR com.android.vending.billing.IInAppBillingService

Ever since modifying my code to use the Android billing library instead of the old IABHelper from the sample app, I have been getting a lot of ANRs with this trace below. Anyone have any idea how to solve that? there isn't a single line of my code on the trace.
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x73b53ac0 self=0x77558a3a00
| sysTid=17097 nice=0 cgrp=default sched=0/0 handle=0x775a8109b0
| state=S schedstat=( 21526708836 9207381756 40660 ) utm=1497 stm=655 core=5 HZ=100
| stack=0x7ff197c000-0x7ff197e000 stackSize=8MB
| held mutexes=
#00 pc 000000000001da2c /system/lib64/libc.so (syscall+28)
#01 pc 00000000000e1ee4 /system/lib64/libart.so (_ZN3art17ConditionVariable16WaitHoldingLocksEPNS_6ThreadE+152)
#02 pc 00000000004e35c8 /system/lib64/libart.so (_ZN3artL12GoToRunnableEPNS_6ThreadE+440)
#03 pc 00000000004e33c8 /system/lib64/libart.so (_ZN3art12JniMethodEndEjPNS_6ThreadE+28)
#04 pc 000000000098a7bc /system/framework/arm64/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+220)
at android.os.BinderProxy.transactNative (Native method)
at android.os.BinderProxy.transact (Binder.java:751)
at com.android.vending.billing.IInAppBillingService$Stub$Proxy.isBillingSupported (IInAppBillingService.java:320)
at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.onServiceConnected (BillingClientImpl.java:839)
at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1818)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1847)
at android.os.Handler.handleCallback (Handler.java:808)
at android.os.Handler.dispatchMessage (Handler.java:101)
at android.os.Looper.loop (Looper.java:166)
at android.app.ActivityThread.main (ActivityThread.java:7425)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
Appears to be an issue with the Play Store reading a file on the UI thread https://issuetracker.google.com/issues/123117066

ANR keyDispatchingTimedOut - Android Native app

In an native cpp application compiled for Android I am getting ANR error with the cause keyDispatchingTimedOut.It only happens sometimes when the app switches from native activity to java activity.
Nothing in the error report really stands out. Most of the threads just sit in a loop waiting for input. I cant disclose any code but the code at 58b505 is from android_native_app_glue library.
I have attached the ANR error report: full ANR on pastebin
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x741e33c0 self=0xab684ea8
| sysTid=29202 nice=-1 cgrp=default sched=0/0 handle=0xf778fb34
| state=S schedstat=( 962236509 24407600 624 ) utm=84 stm=12 core=4 HZ=100
| stack=0xff56e000-0xff570000 stackSize=8MB
| held mutexes=
native: pc 0000000000042c9c /system/lib/libc.so (__epoll_pwait+20)
native: pc 00000000000195cf /system/lib/libc.so (epoll_pwait+26)
native: pc 00000000000195dd /system/lib/libc.so (epoll_wait+6)
native: pc 0000000000012d8b /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+102)
native: pc 0000000000013007 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+130)
native: pc 00000000000836fd /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
native: pc 000000000000055d /data/dalvik-cache/arm/system#framework#boot.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:135)
at android.app.ActivityThread.main (ActivityThread.java:5438)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:628)
"Thread-295" prio=6 tid=17 Native
| group="main" sCount=1 dsCount=0 obj=0x12c630a0 self=0xabdbcd60
| sysTid=29269 nice=-1 cgrp=default sched=0/0 handle=0xdabfd930
| state=S schedstat=( 15667236 2344530 115 ) utm=0 stm=1 core=6 HZ=100
| stack=0xdab01000-0xdab03000 stackSize=1014KB
| held mutexes=
native: pc 0000000000016908 /system/lib/libc.so (syscall+28)
native: pc 000000000004167b /system/lib/libc.so (_ZL33__pthread_cond_timedwait_relativeP23pthread_cond_internal_tP15pthread_mutex_tPK8timespec+56)
native: pc 000000000058b505 /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 000000000058b2ed /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 00000000005ac4c7 /data/app/com.package-1/lib/arm/libgame.so (???)
native: pc 000000000004185b /system/lib/libc.so (_ZL15__pthread_startPv+30)
native: pc 00000000000192a5 /system/lib/libc.so (__start_thread+6)

Categories

Resources