Skip to content

ANR in Firebase Analytics dynamite module: Main thread blocked on binder transaction in m7.ge.m (measurementdynamite) #7705

@lincolnrelias

Description

@lincolnrelias

[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@255034118@25.50.34
  • 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:

  1. App logs an analytics event via FirebaseAnalytics.logEvent()
  2. Event is dispatched to measurementdynamite dynamite module
  3. Module's internal Handler (m7.fx.handleMessage) processes event on the main thread
  4. Handler chain calls m7.ge.m() which makes a synchronous binder transaction
  5. Main thread blocks in IPCThreadState::waitForResponse() waiting for Google Play Services
  6. 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)
#1 pc 0x3f2cb libc.so (ioctl + 26)
#2 pc 0x39c1b libbinder.so (android::IPCThreadState::talkWithDriver(bool) + 238)
#3 pc 0x3a855 libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*) + 32)
#4 pc 0x3a62b libbinder.so (android::IPCThreadState::transact(...) + 126)
#5 pc 0x35327 libbinder.so (android::BpBinder::transact(...) + 98)
#6 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@255034118@25.50.34 (180300-0):187)
at m7.gb.a(:com.google.android.gms.dynamite_measurementdynamite@255034118@25.50.34 (180300-0):14)
at m7.gd.b(:com.google.android.gms.dynamite_measurementdynamite@255034118@25.50.34 (180300-0):7)
at m7.fu.c(:com.google.android.gms.dynamite_measurementdynamite@255034118@25.50.34 (180300-0):7)
at m7.fx.handleMessage(:com.google.android.gms.dynamite_measurementdynamite@255034118@25.50.34 (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)

br.com.claro.now.smarttvclient_issue_28051541328b9d04813ec0dbc5ef264a_ANR_session_698147A7016700010CE4EF2BDFEB63B8_DNE_0_v2_stacktrace.txt

// The ANR occurs inside the dynamite module, not in app code.
// App has no control over how measurementdynamite processes events.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions