[Messaging] Fatal IllegalStateException: Broadcast already finished in CloudMessagingReceiver

オープン
#8,788 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, java
領域
mobile-dev

調査の方向性

The crash is raised from BroadcastReceiver.PendingResult.finish() inside CloudMessagingReceiver.zza in the Play Services cloud-messaging library, so the report's stack trace is the main entry point, and the code in this repository is not shown in the payload. Start by checking which resolved play-services-cloud-messaging and Firebase Messaging versions the affected releases 1.52.0 and 1.53.0 use, and whether the BoM-pinned version matches. Done means identifying a known cause, a fixed version, or a reproducible case, and recording it in the issue; a code change would belong in the SDK's receiver handling only after that.

索引モデルが issue の本文から書いたものです。

説明

api: messaging

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.

主要言語
Java
スター
2.6k
フォーク
733
平均マージ
2日 15時間
マージ済み PR(30日)
72

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-android-sdk のほかの issue

firebase/firebase-android-sdk の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。