Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[firebase_messaging]: Android ANR during background service destruction — main thread blocked in releaseWakeLock

Abierto
#18,866 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@SelaseKay ya está trabajando en esto.

Desde el 23/10/2026.

  • #18867 de @SelaseKay — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
android, dart
Área
backend, mobile

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

Needs Attention platform: android plugin: messaging reproduced type: bug
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:

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):

  1. Register a FirebaseMessaging.onBackgroundMessage handler.
  2. Put the app in the background and send FCM messages.
  3. Observe background-service shutdown after message processing.
  4. 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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/flutterfire

Todos los issues de firebase/flutterfire

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.