[Messaging] Fatal IllegalStateException: Broadcast already finished in CloudMessagingReceiver
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 15/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- 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 内容生成。
描述
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-messagingversion in the affected release: Not yet verified- Affected app versions observed in Crashlytics:
1.52.0and1.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:
- The app is running in the background.
- Cloud Messaging handles a broadcast.
CloudMessagingReceivercallsPendingResult.finish().- 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
-
AndroidX Glance catches
IllegalStateExceptionaround its ownPendingResult.finish()call. Its source comment mentions that some OEM devices can throwBroadcast already finishedand referencesb/257513022:
https://android.googlesource.com/platform/frameworks/support/+/e446b28b091a3a58813c2d169de4f629552cb3ac/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CoroutineBroadcastReceiver.kt -
Firebase issue #5553 also involves
CloudMessagingReceiverandPendingResult.finish(), but reports aNullPointerException. We are including it as related context, not claiming it is the same issue:
https://github.com/firebase/firebase-android-sdk/issues/5553
Questions
- Is this a known issue in Firebase Cloud Messaging or
play-services-cloud-messaging? - Could the device-specific behavior referenced by AndroidX issue
b/257513022also affectCloudMessagingReceiver? - Is there a recommended Firebase SDK version or supported workaround for this crash?
- Would it be appropriate for
CloudMessagingReceiverto handle this exception when callingPendingResult.finish()? - 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 小时
- 30 天内合并 PR
- 72
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-android-sdk 的其他 Issue
-
api: remoteconfig
难度 2/5 1-3 小时 新手友好度 78/100
firebase/firebase-android-sdk#8827 ·
维护者通常 1 天内回复
-
Crashlytics plugin writes build ID lists in directory listing order, so APKs can differ between machines可能已有人在做 @mrober 于 8 天前认领。 未关闭api: crashlytics
难度 2/5 1-3 小时 新手友好度 72/100
firebase/firebase-android-sdk#8789 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
api: auth
难度 2/5 1-3 小时 新手友好度 68/100
firebase/firebase-android-sdk#8505 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 15/100
firebase/firebase-android-sdk#8835 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
firebase/firebase-android-sdk#8832 ·
维护者通常 1 天内回复
查看 firebase/firebase-android-sdk 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
NationalSecurityAgency/ghidra#10220 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复
-
RIS export splits an organization name containing “and” into multiple authors可能已有人在做 @Gautam-aman 今天认领。 未关闭status: needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
FailureContext.java rounds down thresholds in lastedAtLeast()可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复