ANR in Firebase Analytics dynamite module: Main thread blocked on binder transaction in m7.ge.m (measurementdynamite)
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Ladybug 2024.2.1
- Firebase Component: Analytics (via measurementdynamite dynamite module)
- Component version: Firebase BOM 33.0.0 / measurementdynamite@[email protected]
- Platform: Android TV (minSdk 24, targetSdk 35)
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Firebase Analytics causes ANRs on Android TV devices when the measurementdynamite module performs a synchronous binder IPC call to Google Play Services on the main thread.
Impact: 100 ANR events affecting 57 users in the last 7 days.
What happens:
- App logs an analytics event via FirebaseAnalytics.logEvent()
- Event is dispatched to measurementdynamite dynamite module
- Module's internal Handler (m7.fx.handleMessage) processes event on the main thread
- Handler chain calls m7.ge.m() which makes a synchronous binder transaction
- Main thread blocks in IPCThreadState::waitForResponse() waiting for Google Play Services
- If Play Services is slow to respond (busy, restarting, memory pressure), ANR occurs
ANR Stack Trace (main thread): main (native):tid=1 systid=3300 #00 pc 0x71258 libc.so (__ioctl + 8) #01 pc 0x3f2cb libc.so (ioctl + 26) #02 pc 0x39c1b libbinder.so (android::IPCThreadState::talkWithDriver(bool) + 238) #03 pc 0x3a855 libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*) + 32) #04 pc 0x3a62b libbinder.so (android::IPCThreadState::transact(...) + 126) #05 pc 0x35327 libbinder.so (android::BpBinder::transact(...) + 98) #06 pc 0xc7ecf libandroid_runtime.so (android_os_BinderProxy_transact(...) + 82) at android.os.BinderProxy.transactNative(Native method) at android.os.BinderProxy.transact(BinderProxy.java:540) at m7.ge.m(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):187) at m7.gb.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):14) at m7.gd.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):7) at m7.fu.c(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):7) at m7.fx.handleMessage(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (180300-0):265) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:250) at android.app.ActivityThread.main(ActivityThread.java:7848)
Why this is not controllable by app developers: The blocking code is inside Google's measurementdynamite dynamite module (loaded from Google Play Services), not the Firebase SDK embedded in the app. Updating Firebase SDK version does not change this behavior.
Expected behavior: Firebase Analytics should not perform synchronous binder IPC on the main thread. Event processing should be fully asynchronous to prevent ANRs.
Suggested fix: Move the binder transaction in m7.ge.m() off the main thread or use asynchronous binder mechanisms.
Relevant Code:
// Standard Firebase Analytics usage - nothing unusual FirebaseAnalytics.getInstance(context).logEvent("event_name", bundle)
// The ANR occurs inside the dynamite module, not in app code. // App has no control over how measurementdynamite processes events.
Hi @lincolnrelias, sorry for the late response and thank you for raising this issue. Let me raise this to our engineers for investigation and see what we can do here. I'll get back to you as soon as I hear back from the. Thanks!
This bug is tracked internally in b/495440438
I also have the same problem. erro info main (native):tid=1 systid=6933 #00 pc 0xd7854 libc.so (__ioctl + 4) #01 pc 0x93f68 libc.so (ioctl + 160) #02 pc 0x51cc4 libbinder.so (android::IPCThreadState::talkWithDriver(bool) + 300) #03 pc 0x52cd4 libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*) + 60) #04 pc 0x52a3c libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int) + 188) #05 pc 0x4b0ac libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int) + 180) #06 pc 0x12c290 libandroid_runtime.so (android_os_BinderProxy_transact(_JNIEnv*, _jobject*, int, _jobject*, _jobject*, int) + 152) at android.os.BinderProxy.transactNative(Native method) at android.os.BinderProxy.transact(BinderProxy.java:593) at m7.ge.m(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):187) at m7.gb.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):14) at m7.gd.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):7) at m7.fu.c(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):7) at m7.fx.handleMessage(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):264) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8069) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Hey team, We’re still encountering this ANR and wanted to check if there’s any update or insight on it. This issue has been persisting for quite some time, and we’ve been unable to reliably reproduce it on our end. It appears to be a user-perceived ANR occurring across multiple Android OS versions. This is our top most ANR,
Last 7 days Affected Users : 144 Events : 198
We’re currently using firebaseBom = "34.3.0", and from the traces, the main thread is getting blocked in a Binder transaction involving Google Play Services (measurementdynamite), as shown below:
"main" tid=1 Native
#00 pc 0x00000000000e0bb8 /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+8)
#01 pc 0x0000000000097a3c /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+160)
#02 pc 0x000000000006c8ec /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver+284)
#03 pc 0x000000000006db54 /system/lib64/libbinder.so (android::IPCThreadState::waitForResponse+76)
#04 pc 0x000000000006d890 /system/lib64/libbinder.so (android::IPCThreadState::transact+224)
#05 pc 0x0000000000059a70 /system/lib64/libbinder.so (android::BpBinder::transact+236)
#06 pc 0x000000000018007c /system/lib64/libandroid_runtime.so (android_os_BinderProxy_transact+156)
at android.os.BinderProxy.transactNative (Native method)
at android.os.BinderProxy.transact (BinderProxy.java:646)
at m7.ge.m (:[email protected]:180)
...
at android.os.Looper.loop (Looper.java:300)
at android.app.ActivityThread.main (ActivityThread.java:8410)
cc : @lehcar09
Hey @lehcar09
We are facing the ANR and is our largest ANR now. Is there any update on the above? We’re currently using firebaseBom = "34.3.0"
"main" tid=1 Native
#00 pc 0x00000000000d7b74 /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
#01 pc 0x0000000000093f70 /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+160)
#02 pc 0x0000000000051c7c /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+300)
#03 pc 0x0000000000052c8c /system/lib64/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+60)
#04 pc 0x00000000000529f4 /system/lib64/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+188)
#05 pc 0x000000000004b0b0 /system/lib64/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+152)
#06 pc 0x00000000001270c0 /system/lib64/libandroid_runtime.so (android_os_BinderProxy_transact(_JNIEnv*, _jobject*, int, _jobject*, _jobject*, int)+152)
at android.os.BinderProxy.transactNative (Native method)
at android.os.BinderProxy.transact (BinderProxy.java:565)
at m7.ge.m (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):187)
at m7.gb.a (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):14)
at m7.gd.b (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):7)
at m7.fu.c (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):7)
at m7.fx.handleMessage (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150400-0):264)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:257)
at android.app.ActivityThread.main (ActivityThread.java:8192)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:626)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1015)
@lehcar09 one more report, is there any update on this?
main (native):tid=1 systid=30664
#00 pc 0xc1de8 libc.so (__ioctl + 8) (BuildId: c3622b5c0a4cde0d723ea2d964ec71b7)
#01 pc 0x73d4c libc.so (ioctl + 156) (BuildId: c3622b5c0a4cde0d723ea2d964ec71b7)
#02 pc 0x614d8 libbinder.so (android::IPCThreadState::talkWithDriver + 280) (BuildId: 1fd6e2938b5c475563a7fa593f1fccb0)
#03 pc 0x6289c libbinder.so (android::IPCThreadState::waitForResponse + 60) (BuildId: 1fd6e2938b5c475563a7fa593f1fccb0)
#04 pc 0x625d8 libbinder.so (android::IPCThreadState::transact + 216) (BuildId: 1fd6e2938b5c475563a7fa593f1fccb0)
#05 pc 0x7aecc libbinder.so (android::BpBinder::transact + 188) (BuildId: 1fd6e2938b5c475563a7fa593f1fccb0)
#06 pc 0x19f9c8 libandroid_runtime.so (android_os_BinderProxy_transact + 152) (BuildId: 5c5f7c8a751f2a7da42af4e621fa2168)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:599)
at m7.fv.m(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):180)
at m7.fs.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):14)
at m7.fu.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):7)
at m7.fl.c(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):7)
at m7.fo.handleMessage(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):264)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8391)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:640)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
Same here. This is causing about 10% of all ANRs in our production app right now, so it's a pretty big deal for us. Any updates or workarounds on this?
Any update? this is the #1 ANR in our app
Hi @lehcar09, are there any updates on this issue? This has been one of the major ANR causes for us since January, and it's still happening daily After analyzing our device data, we noticed this seems to recur far more often on Spreadtrum/UNISOC T612 (devices like realme RE5C9F/RE58BC/RE6054), in case that helps to reproduce it Also providing a stacktrace:
"main" tid=1 Native
#00 pc 0x00000000000ab9e8 /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+8)
#01 pc 0x000000000005d99c /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156)
#02 pc 0x000000000005b5e8 /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver+280)
#03 pc 0x000000000005c840 /system/lib64/libbinder.so (android::IPCThreadState::waitForResponse+112)
#04 pc 0x000000000005c548 /system/lib64/libbinder.so (android::IPCThreadState::transact+216)
#05 pc 0x0000000000053c8c /system/lib64/libbinder.so (android::BpBinder::transact+188)
#06 pc 0x0000000000176df8 /system/lib64/libandroid_runtime.so (android_os_BinderProxy_transact+152)
at android.os.BinderProxy.transactNative (Native method)
at android.os.BinderProxy.transact (BinderProxy.java:595)
at m7.es.m (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):180)
at m7.ep.a (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):14)
at m7.er.b (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):7)
at m7.ei.c (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):9)
at m7.el.handleMessage (:com.google.android.gms.dynamite_measurementdynamite@[email protected] (190400-0):280)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:8194)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:911)
I got the same issue, after checking i saw Firebase uses alot of "lock" for ther initialize progress which could cause lots of ANR in case of using Firebase from another thread.
I also have the same problem. A very large number of ANRs—it’s the #1 issue.
Please give this your attention and expedite a resolution.
stacktrace (25).log stacktrace (26).log stacktrace (27).log stacktrace (28).log stacktrace (29).log stacktrace (30).log stacktrace (31).log stacktrace (32).log stacktrace (33).log stacktrace (34).log stacktrace (35).log stacktrace (36).log stacktrace (37).log stacktrace (38).log stacktrace (39).log stacktrace (40).log
Any progress? This ANR accounts for a significant portion of issues in our app.
We also encountered this problem and hope it can be fixed as soon as possible.