Skip to content

com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invokeSuspend ANR triggered by thread waiting for a binder transaction #70

@dk-a-dev

Description

@dk-a-dev

The Issue:
An ANR (Application Not Responding) dialog appears when your app's UI thread (also known as the main thread) is blocked for too long, typically around 5 seconds. This makes the app unresponsive to user input, leading to a frustrating user experience. Android then offers the user the option to "Wait" or "Close app."
In your specific case, the ANR stack trace points directly to a culprit: com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invokeSuspend
This method is located within your com.dscvit.vitty library, in the AlarmReceiver.kt file.
How com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invokeSuspend is Causing the ANR
Let's dissect the stack trace and the ANR types provided:
AlarmReceiver : This class strongly suggests that your ANR is occurring within a BroadcastReceiver . BroadcastReceiver s are components that listen for system-wide broadcast announcements (like alarms, battery low, etc.). When a broadcast is received, the onReceive() method is called. Crucially, onReceive() executes on the main thread .
fetchData : This method name clearly indicates that your app is attempting to retrieve data. Data fetching operations, especially network requests or database queries, are inherently I/O-bound and can take a significant amount of time.
$2.invokeSuspend : This syntax is characteristic of a coroutine's suspend function . When you see $2 it often indicates an anonymous inner class or a lambda, and invokeSuspend is the entry point for the actual suspended code within a coroutine. This tells us that fetchData is likely implemented as an asynchronous operation using Kotlin Coroutines.
ANR Types: "The main thread was busy doing a Binder call that was potentially slow." and "The latency of a Binder call is hard to predict... avoid, if possible, making Binder calls in the main thread."
This is the most critical piece of information. While fetchData itself might involve network or database I/O, the ANR is specifically flagging a Binder call .
What is a Binder call? Binder is Android's inter-process communication (IPC) mechanism. It allows different processes (e.g., your app, the system server, other apps) to communicate and share data. Common scenarios where Binder calls occur include:
Interacting with system services (e.g., LocationManager , AudioManager , PackageManager , JobScheduler , AlarmManager , ContentResolver for some operations).
Communicating with other apps via AIDL.
Accessing ContentProvider s, especially if they are in a different process.
Why is it causing an ANR on the main thread? When your AlarmReceiver 's onReceive() method (which runs on the main thread) initiates a fetchData coroutine, and within that coroutine, there's a blocking Binder call , the main thread gets stuck waiting for that Binder call to complete.
"latency... hard to predict... treat them as you would treat I/O calls" : This reinforces the idea that Binder calls can be slow and should be handled off the main thread, just like network or disk I/O. System server contention or complex operations on the service side can significantly increase their latency.
@

Stack

Crashlytics - Stack trace

Application: com.dscvit.vitty

Platform: android

Version: 3.0.3 (47)

Issue: aa774feb29ff377d61760006372532cd

Session: 68E43006000100012B6EA1BDD4013AB3_DNE_0_v2

Date: Tue Oct 07 2025 02:56:58 GMT+0530 (India Standard Time)

main (native):tid=1 systid=11118
#00 pc 0xb5e14 libc.so (__ioctl + 4) (BuildId: c1c14324f7e3a753e7829bf747976f43)
#1 pc 0x67eec libc.so (ioctl + 156) (BuildId: c1c14324f7e3a753e7829bf747976f43)
#2 pc 0x5f4d8 libbinder.so (android::IPCThreadState::talkWithDriver + 280) (BuildId: 75a0fb141a8479edf420ebe6d4ad10a6)
#3 pc 0x6089c libbinder.so (android::IPCThreadState::waitForResponse + 60) (BuildId: 75a0fb141a8479edf420ebe6d4ad10a6)
#4 pc 0x605d8 libbinder.so (android::IPCThreadState::transact + 216) (BuildId: 75a0fb141a8479edf420ebe6d4ad10a6)
#5 pc 0x7925c libbinder.so (android::BpBinder::transact + 188) (BuildId: 75a0fb141a8479edf420ebe6d4ad10a6)
#6 pc 0x19e928 libandroid_runtime.so (android_os_BinderProxy_transact + 152) (BuildId: d1a2002f30855b34ededbc0aa59f09a4)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:628)
at android.system.keystore2.IKeystoreService$Stub$Proxy.getKeyEntry(IKeystoreService.java:340)
at android.security.KeyStore2.lambda$getKeyEntry$5(KeyStore2.java:262)
at android.security.KeyStore2$$ExternalSyntheticLambda4.execute(unavailable:2)
at android.security.KeyStore2.handleRemoteExceptionWithRetry(KeyStore2.java:110)
at android.security.KeyStore2.getKeyEntry(KeyStore2.java:262)
at android.security.keystore2.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:373)
at android.security.keystore2.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:360)
at android.security.keystore2.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:120)
at java.security.KeyStore.getKey(KeyStore.java:1083)
at com.google.android.gms.internal.firebase-auth-api.zznb.(com.google.firebase:firebase-auth@@23.2.1:2)
at com.google.android.gms.internal.firebase-auth-api.zznc.zza(com.google.firebase:firebase-auth@@23.2.1:1)
at com.google.android.gms.internal.firebase-auth-api.zzne.(com.google.firebase:firebase-auth@@23.2.1:3)
at com.google.android.gms.internal.firebase-auth-api.zznd.zza(com.google.firebase:firebase-auth@@23.2.1:3)
at com.google.android.gms.internal.firebase-auth-api.zzmy$zza.zzb(com.google.firebase:firebase-auth@@23.2.1:19)
at com.google.android.gms.internal.firebase-auth-api.zzmy$zza.zza(com.google.firebase:firebase-auth@@23.2.1:71)
at com.google.firebase.auth.internal.zzby.zzb(com.google.firebase:firebase-auth@@23.2.1:11)
at com.google.firebase.auth.internal.zzby.zza(com.google.firebase:firebase-auth@@23.2.1:18)
at com.google.firebase.auth.internal.zzcb.zza(com.google.firebase:firebase-auth@@23.2.1:81)
at com.google.firebase.auth.internal.zzcb.zza(com.google.firebase:firebase-auth@@23.2.1:1)
at com.google.firebase.auth.FirebaseAuth.(com.google.firebase:firebase-auth@@23.2.1:352)
at com.google.firebase.auth.FirebaseAuth.(com.google.firebase:firebase-auth@@23.2.1:323)
at com.google.firebase.auth.internal.zzad.(com.google.firebase:firebase-auth@@23.2.1:1)
at com.google.firebase.auth.FirebaseAuthRegistrar.lambda$getComponents$0(com.google.firebase:firebase-auth@@23.2.1:11)
at com.google.firebase.auth.zzaf.create(unavailable:11)
at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$com-google-firebase-components-ComponentRuntime(ComponentRuntime.java:160)
at com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda2.get(D8$$SyntheticClass)
at com.google.firebase.components.Lazy.get(Lazy.java:53)
at com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider.lambda$new$1$com-google-firebase-firestore-auth-FirebaseAuthCredentialsProvider(FirebaseAuthCredentialsProvider.java:81)
at com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider$$ExternalSyntheticLambda1.handle(D8$$SyntheticClass)
at com.google.firebase.components.OptionalProvider.whenAvailable(OptionalProvider.java:77)
at com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider.(FirebaseAuthCredentialsProvider.java:78)
at com.google.firebase.firestore.FirebaseFirestore.newInstance(FirebaseFirestore.java:196)
at com.google.firebase.firestore.FirestoreMultiDbComponent.get(FirestoreMultiDbComponent.java:69)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(FirebaseFirestore.java:178)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(FirebaseFirestore.java:129)
at com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invokeSuspend(AlarmReceiver.kt:100)
at com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invoke(unavailable:8)
at com.dscvit.vitty.receiver.AlarmReceiver$fetchData$2.invoke(unavailable:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
at com.dscvit.vitty.receiver.AlarmReceiver.fetchData(AlarmReceiver.kt:99)
at com.dscvit.vitty.receiver.AlarmReceiver.access$fetchData(AlarmReceiver.kt:23)
at com.dscvit.vitty.receiver.AlarmReceiver$fetchFirestore$1.invokeSuspend(AlarmReceiver.kt:91)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
at kotlinx.coroutines.BuildersKt.runBlocking(unavailable:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
at kotlinx.coroutines.BuildersKt.runBlocking$default(unavailable:1)
at com.dscvit.vitty.receiver.AlarmReceiver.fetchFirestore(AlarmReceiver.kt:90)
at com.dscvit.vitty.receiver.AlarmReceiver.onReceive(AlarmReceiver.kt:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4975)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(unavailable)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2642)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:328)
at android.app.ActivityThread.main(ActivityThread.java:9185)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:586)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

ReferenceQueueDaemon (waiting):tid=6 systid=11128
at java.lang.Object.wait(Native method)
at java.lang.Object.wait(Object.java:405)
at java.lang.Object.wait(Object.java:543)
at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:260)
at java.lang.Daemons$Daemon.run(Daemons.java:132)
at java.lang.Thread.run(Thread.java:1119)

FinalizerDaemon (waiting):tid=7 systid=11129
at java.lang.Object.wait(Native method)
at java.lang.Object.wait(Object.java:405)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:207)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:228)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:348)
at java.lang.Daemons$Daemon.run(Daemons.java:132)
at java.lang.Thread.run(Thread.java:1119)

FinalizerWatchdogDaemon (timed waiting):tid=8 systid=11130
at java.lang.Thread.sleep(Native method)
at java.lang.Thread.sleep(Thread.java:451)
at java.lang.Thread.sleep(Thread.java:356)
at java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos(Daemons.java:534)
at java.lang.Daemons$FinalizerWatchdogDaemon.waitForProgress(Daemons.java:593)
at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:465)
at java.lang.Daemons$Daemon.run(Daemons.java:132)
at java.lang.Thread.run(Thread.java:1119)

GmsDynamite (waiting):tid=21 systid=11152
at java.lang.Object.wait(Native method)
at java.lang.Object.wait(Object.java:405)
at java.lang.Object.wait(Object.java:543)
at com.google.android.gms.dynamite.zza.run(com.google.android.gms:play-services-basement@@18.5.0:2)

OkHttp ConnectionPool (timed waiting):tid=37 systid=11178
at java.lang.Object.wait(Native method)
at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)

Okio Watchdog (waiting):tid=39 systid=11180
at java.lang.Object.wait(Native method)
at java.lang.Object.wait(Object.java:405)
at java.lang.Object.wait(Object.java:543)
at com.android.okhttp.okio.AsyncTimeout.awaitTimeout(AsyncTimeout.java:313)
at com.android.okhttp.okio.AsyncTimeout.access$000(AsyncTimeout.java:42)
at com.android.okhttp.okio.AsyncTimeout$Watchdog.run(AsyncTimeout.java:288)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmajor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions