question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalStateException: Too many receivers

See original GitHub issue

Hello!

I am trying to connect to a LE device periodically via WorkManager. On certain devices I am getting the following crash. Is there any situation when we are leaking some receiver instance?

Do we have to close some resources after job done to unregister the receiver which no.nordicsemi.android.ble.BleManager may be using?

Thanks!

Fatal Exception: java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: 19004, callerPackage: a.b.c.
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2434)
       at android.os.Parcel.createException(Parcel.java:2410)
       at android.os.Parcel.readException(Parcel.java:2393)
       at android.os.Parcel.readException(Parcel.java:2335)
       at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5560)
       at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1776)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1730)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1718)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:726)
       at no.nordicsemi.android.ble.BleManager.<init>(BleManager.java:176)
       at no.nordicsemi.android.ble.livedata.ObservableBleManager.<init>(ObservableBleManager.java:24)
       at a.b.b.RBleManager.<init>(RBleManager.kt:102)
       at a.b.b.RBleManager.<init>(RBleManager.kt:92)
       at a.b.c.tina.PeriodicRDataModule.provideBleManager(PeriodicRDataModule.java:45)
       at a.b.c.tina.PeriodicRDataModule_ProvideBleManagerFactory.provideBleManager(PeriodicRDataModule_ProvideBleManagerFactory.java:69)
       at a.b.c.tina.DaggerPeriodicRDataComponent.getRBleManager(DaggerPeriodicRDataComponent.java:31)
       at a.b.c.tina.DaggerPeriodicRDataComponent.injectPeriodicRDataWorker(DaggerPeriodicRDataComponent.java:50)
       at a.b.c.tina.DaggerPeriodicRDataComponent.inject(DaggerPeriodicRDataComponent.java:44)
       at a.b.c.tina.PeriodicRDataWorker$1.invokeSuspend(PeriodicRDataWorker.kt:47)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7941)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
philips77commented, Nov 19, 2022

You may try canaryleak library from Square to investigate the leaks.

0reactions
philips77commented, Nov 24, 2022

I was interested whether you’re getting a logs about closing the managers. If you override log(...) method, and override getMinLogLevel() to return Log.DEBUG, you should see e.g. where “close()” is called, etc.

I’m waiting for updates regarding a single manager instance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalStateException: Too many receivers, total of ...
It only happens to a certain percentage of our users, but the ones who have it it's super severe (on 10 users we...
Read more >
IllegalStateException: Too many receivers, total of 1000
I get this kind of log on crashlytics. Fatal Exception: java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: ...
Read more >
android.os.Parcel.createException Too many receivers, total ...
Try searching registerReceiver() method usage in your code. A possible issue is that you register receiver and don't unregister it when it's not ......
Read more >
at android.os.Parcel.createExceptionOrNull(Parcel.java)] Too ...
IllegalStateException : at android.os.Parcel.createExceptionOrNull(Parcel.java)] Too many receivers, total of 1000, registered for pid.
Read more >
Register too many Broadcast Receivers [37117264]
Hello, I found a weird bug today reported by Fabric-Crashlytics. It has happened 70 times only to one user with device HUAWEI VNS-L21...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found