Skip to content

[Messaging] Fatal IllegalStateException: Broadcast already finished in CloudMessagingReceiver #8788

Open

Description

@harry235day

Environment

  • Firebase component: Firebase Cloud Messaging for Android
  • Firebase BoM configured in the currently checked source: 34.17.0
  • Firebase Messaging version in the affected release: Not yet verified
  • play-services-cloud-messaging version in the affected release: Not yet verified
  • Affected app versions observed in Crashlytics: 1.52.0 and 1.53.0
  • Android versions observed: Android 14 and Android 15
  • Device models observed include Samsung SM-G7810, Samsung SM-F7110, and Xiaomi M2007J3SY

The configured BoM version above is from the current source tree. We have not yet verified the resolved dependency versions in the affected release artifacts.

Problem

We are seeing a fatal crash reported by Firebase Crashlytics:

java.lang.IllegalStateException: Broadcast already finished

The crash occurs while CloudMessagingReceiver is calling BroadcastReceiver.PendingResult.finish().

Recent Crashlytics samples were recorded while the app was in the background. One sample recorded a notification_receive event approximately two seconds before the crash, but we cannot determine from the available data whether that notification directly caused the crash.

In a report retrieved on November 3, 2026, Crashlytics showed four events affecting four users in its default seven-day reporting window. We have also observed this issue in earlier app versions.

We do not know what completed the broadcast before the call shown in the crash stack, or whether this is related to device-specific behavior.

Steps to reproduce

We do not currently have a reliable local reproduction. The crash was observed in production through Crashlytics.

The available samples suggest this context:

  1. The app is running in the background.
  2. Cloud Messaging handles a broadcast.
  3. CloudMessagingReceiver calls PendingResult.finish().
  4. Android throws IllegalStateException: Broadcast already finished.

These are observations from the reports, not confirmed reproduction steps.

Expected behavior

The app should not crash while Cloud Messaging finishes processing a broadcast.

Actual behavior

The process crashes with the following fatal exception:

Fatal Exception: java.lang.IllegalStateException: Broadcast already finished
       at android.content.BroadcastReceiver$PendingResult.sendFinished(BroadcastReceiver.java:303)
       at android.content.BroadcastReceiver$PendingResult.finish(BroadcastReceiver.java:288)
       at com.google.android.gms.cloudmessaging.CloudMessagingReceiver.zza(:179)
       at com.google.android.gms.cloudmessaging.zzg.run(:10)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at com.google.android.gms.common.util.concurrent.zza.run(:6)
       at java.lang.Thread.run(Thread.java:1019)

Other threads included in the supplied crash report:

process reaper:
       at jdk.internal.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:401)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1131)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1019)

process reaper:
       at jdk.internal.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:401)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1131)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1019)

FinalizerDaemon:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:386)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:210)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:231)
       at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:309)
       at java.lang.Daemons$Daemon.run(Daemons.java:145)
       at java.lang.Thread.run(Thread.java:1019)

ReferenceQueueDaemon:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:386)
       at java.lang.Object.wait(Object.java:524)
       at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:239)
       at java.lang.Daemons$Daemon.run(Daemons.java:145)
       at java.lang.Thread.run(Thread.java:1019)

FinalizerWatchdogDaemon:
       at java.lang.Thread.sleep(Thread.java)
       at java.lang.Thread.sleep(Thread.java:455)
       at java.lang.Thread.sleep(Thread.java:360)
       at java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos(Daemons.java:481)
       at java.lang.Daemons$FinalizerWatchdogDaemon.waitForProgress(Daemons.java:544)
       at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:412)
       at java.lang.Daemons$Daemon.run(Daemons.java:145)
       at java.lang.Thread.run(Thread.java:1019)

Related reports

Questions

  1. Is this a known issue in Firebase Cloud Messaging or play-services-cloud-messaging?
  2. Could the device-specific behavior referenced by AndroidX issue b/257513022 also affect CloudMessagingReceiver?
  3. Is there a recommended Firebase SDK version or supported workaround for this crash?
  4. Would it be appropriate for CloudMessagingReceiver to handle this exception when calling PendingResult.finish()?
  5. What additional logs, dependency information, or reproduction details would help investigate the first completion of the broadcast?

We can provide additional information as it becomes available.

Activity

  1. lehcar09 commented on Nov 3, 2026

    @lehcar09
    Contributor

    Hi @harry235day, thank you for reaching out.

    Is this a known issue in Firebase Cloud Messaging or play-services-cloud-messaging?

    I can't find similar reports about this issue. The closest one I found is the same b/257513022 issue reported in Glance.

    Could the device-specific behavior referenced by AndroidX issue b/257513022 also affect CloudMessagingReceiver?

    I can't say anything for sure. Can you share the percentage of affected users for the past month?

    Aside from that, when did you start seeing this report?

    Is there a recommended Firebase SDK version or supported workaround for this crash?

    None. However, I would recommend to updating to latest Firebase SDK - BoM version 35.1.0. We usually suggest developers to use the latest version to ensure that you have the latest improvements and bug fixes.

    Would it be appropriate for CloudMessagingReceiver to handle this exception when calling PendingResult.finish()?

    It looks reasonable for me. The exception means the broadcast is already finished. Swallowing it doesn't leave the broadcast stuck. At most it hides an unexpected double-finish, so logging it would keep visibility.

    I will raise this to our engineers and see what we can do here.

  2. harry235day commented on Nov 4, 2026

    @harry235day
    Author

    @lehcar09 Thank you for looking into this and for raising it with the engineering team.

    For the past 30 days shown in Crashlytics (October 6 to November 4, 2026), this issue was reported 33 times and affected 10 users.

    We have not yet confirmed the total number of active users for the same period, so we cannot provide an accurate affected-user percentage at the moment. We will follow up once we have the matching denominator.

    Regarding when the issue started: the earliest event sample we have checked is from August 25, 2026. The Crashlytics issue metadata lists app version 1.17.0 as the first-seen version, but we have not confirmed the exact date of the first occurrence.

    We appreciate your suggestion to handle the exception and log it in CloudMessagingReceiver. Since the call to PendingResult.finish() is inside the SDK, it would be helpful to know whether the engineering team considers adding that handling in a future release.

    We will also evaluate the suggested Firebase BoM upgrade and monitor whether the issue continues. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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