[firebase_messaging]: Android ANR during background service destruction — main thread blocked in releaseWakeLock
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start by reading JobIntentService.java, especially CompatWorkEnqueuer.serviceProcessingFinished and the onDestroy call path shown in the captured stack; compare it with the related reports linked in the issue. The report has no reliable reproduction, and the system-side Binder delay is unknown, so first determine whether the wake-lock cleanup can be changed safely and what diagnostics would identify the delay. Done means a validated finding or fix for the teardown stall, with supporting reproduction or diagnostics.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Messaging
Which platforms are affected?
Android
Description
Which plugins are affected?
firebase_messaging
Which platforms are affected?
Android
Description
Crashlytics recorded a production ANR while Firebase Messaging's background
service was being destroyed.
The main thread was blocked in a Binder transaction to
IPowerManager.releaseWakeLock, called by
JobIntentService$CompatWorkEnqueuer.serviceProcessingFinished.
The captured call path is:
ActivityThread.handleStopService
→ JobIntentService.onDestroy
→ doStopCurrentWork
→ CommandProcessor.cancel
→ processorFinished
→ CompatWorkEnqueuer.serviceProcessingFinished
→ PowerManager.WakeLock.release
→ IPowerManager.releaseWakeLock
→ BinderProxy.transactNative
This appears to expose the main thread to a blocking power-service Binder
transaction during service teardown. We cannot determine from the app's
thread dump why the system-side transaction was delayed.
Versions
- firebase_messaging: 16.5.0
- App version: 1.11.3 (93)
- Flutter version: [insert version used to build the affected release]
- firebase_core: [insert version from the affected release's pubspec.lock]
- Android version and device model: [insert from Crashlytics]
Reproducing the issue
Observed in production through Crashlytics. We do not currently have
reliable steps to reproduce it locally.
The captured stack shows Android stopping the Firebase Messaging
background service. The exact message payload and device conditions
preceding the ANR are unknown.
Relevant log output
main (native):tid=1 systid=31600
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:679)
at android.os.IPowerManager$Stub$Proxy.releaseWakeLock(IPowerManager.java:1423)
at android.os.PowerManager$WakeLock.release(PowerManager.java:3985)
at android.os.PowerManager$WakeLock.release(PowerManager.java:3954)
at io.flutter.plugins.firebase.messaging.JobIntentService$CompatWorkEnqueuer.serviceProcessingFinished(JobIntentService.java:179)
at io.flutter.plugins.firebase.messaging.JobIntentService.processorFinished(JobIntentService.java:593)
at io.flutter.plugins.firebase.messaging.JobIntentService$CommandProcessor.cancel(JobIntentService.java:383)
at io.flutter.plugins.firebase.messaging.JobIntentService.doStopCurrentWork(JobIntentService.java:561)
at io.flutter.plugins.firebase.messaging.JobIntentService.onDestroy(JobIntentService.java:439)
at android.app.ActivityThread.handleStopService(ActivityThread.java:5563)
at android.app.ActivityThread.-$$Nest$mhandleStopService(unavailable)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2727)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:282)
at android.os.Looper.loop(Looper.java:387)
at android.app.ActivityThread.main(ActivityThread.java:9500)
Additional context
- Event captured on October 19, 2026.
- We compared JobIntentService.java in the published 16.5.0 and 17.0.1
packages. The files are identical, including the wake-lock release at
line 179 and the service destruction path. - We have not reproduced or validated this ANR on 17.0.1.
- The full app thread dump is attached.
Related reports:
- https://github.com/firebase/flutterfire/issues/12832
- https://github.com/firebase/flutterfire/issues/18789
These describe related notification/background-processing problems, but
their reported failure paths differ from this wake-lock release stall.
Could you investigate whether wake-lock cleanup during service destruction
can avoid blocking the main thread, and advise what additional diagnostics
would help identify the system-side delay?
Reproducing the issue
We do not have a reliable local reproduction. This ANR was observed in
production through Firebase Crashlytics on Android, using
firebase_messaging 16.5.0.
The captured stack shows Android destroying the Firebase Messaging
background service. During onDestroy(), the main thread becomes blocked
in IPowerManager.releaseWakeLock through
JobIntentService$CompatWorkEnqueuer.serviceProcessingFinished.
The exact message payload, app state preceding service shutdown, and
device conditions that triggered the delay are unknown. The full thread
dump is attached.
Suggested investigation scenario (not confirmed reproduction steps):
- Register a FirebaseMessaging.onBackgroundMessage handler.
- Put the app in the background and send FCM messages.
- Observe background-service shutdown after message processing.
- Check for a main-thread stall in WakeLock.release during onDestroy.
We cannot currently provide a minimal project that reliably reproduces
the issue.
Firebase Core version
4.15.0
Flutter Version
3.47.0
Relevant Log Output
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response
- Lenguaje dominante
- Dart
- Estrellas
- 9.3k
- Forks
- 4.1k
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 78
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firebase/flutterfire
-
[firebase_in_app_messaging]: Android build fails with `Could not find com.google.firebase:firebase-inappmessaging:.` since 0.10.0Posiblemente ocupada @SelaseKay la tomó hoy. AbiertoNeeds Attention platform: android plugin: in_app_messaging reproduced type: bug
firebase/flutterfire#18872 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
blocked: customer-response Needs Attention platform: ios plugin: messaging Stale type: bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
firebase/flutterfire#18776 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
[firebase_storage] Windows native crash in upload progress callback, sink ownership and thread dispatchQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoblocked: flutter platform: windows plugin: storage reproduced type: bug
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
firebase/flutterfire#18664 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[core] Decouple platform_interface from Flutter for pure-Dart webQuizá libre de nuevo @Lyokone la tomó hace 39 días y no hay ningún pull request abierto. AbiertoNeeds Attention platform: all platform: web plugin: core type: enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
firebase/flutterfire#18645 · 3 comentarios · 2 reacciones · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
blocked: firebase-sdk platform: android plugin: messaging reproduced type: bug
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
firebase/flutterfire#18644 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de firebase/flutterfire
Issues similares
-
Docs: correct the unbuilt "full re-verify" claim and three untrue sync commentsPosiblemente ocupada @ibanner56 la tomó hoy. Abiertoarea: sync priority: low severity: trivial type: docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
ibanner56/CallersCompendium#1942 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: 编辑器替换栏关闭按钮错位Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
appshubcc/Bettbox#584 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Desktop] 多图作品在大图预览中无法使用鼠标滚轮缩放Abiertobug UI: Fluent
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Notsfsssf/pixez-flutter#1430 ·
Los mantenedores suelen responder en 1 día
-
backlog:low bug data-source localization
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
simonoppowa/OpenNutriTracker#1475 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
linagora/tmail-flutter#5034 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día