Vladimir Jovanović Vladimir Jovanović - 1 year ago 128
Android Question

Fatal Exception: java.lang.SecurityException: !@Too many alarms (500) registered inside Firebase

I am getting following crash:

Fatal Exception: java.lang.SecurityException: !@Too many alarms (500) registered from pid 27251 uid 11383
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:217)
at android.app.AlarmManager.setImpl(AlarmManager.java:484)
at android.app.AlarmManager.set(AlarmManager.java:260)
at com.google.firebase.iid.FirebaseInstanceIdService.zzagl(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzd(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

As you can see crash is inside Firebase library. I read other answers but all of them are about usage of Alarms inside code, like this one. I am using just Firebase libraries for messages, analytics and remote config.

compile "com.google.firebase:firebase-core:$firebaseLibVersion"
compile "com.google.firebase:firebase-config:$firebaseLibVersion"
compile "com.google.firebase:firebase-messaging:$firebaseLibVersion"

ext {
firebaseLibVersion = '9.6.1'

Problems is happening only on Samsung devices, as expected. So, I know why it's happening on Samsung devices, but I don't know how to fix it.

Answer Source

From the firebase-talk mailing list:

We've found the cause of this bug. The FCM SDK can get stuck while syncing the (un)subscribed list of topics. The bug can happen when the device is offline during the subscribeToTopic / unsubscribeFromTopic operations and can lead to battery draining and app crashes on specific Samsung devices. The only way to exit this state is to connect the phone to the internet and open the app to allow the topics list to sync with the server.

We are close to a fix, but due to our release cycle, we won't have a new SDK in your hands for at least a few weeks. For now, you can downgrade to 9.4.0 as Mihir suggested.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download