flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [firebase_messaging] Channel is unrecoverably broken and will be disposed!

Open Geparder opened this issue 1 year ago • 5 comments

Bug report

Describe the bug When calling onBackgroundMessage the application crashes without fixing the error

FirebaseMessaging.onBackgroundMessage(initMessage);

Steps to reproduce

Steps to reproduce the behavior:

  1. Start app
  2. Close app
  3. Wait send message in background
  4. Start app
  5. !! Crash

Expected behavior

without crash

Sample project

The test version of the application began to crash on one of the emulators after connecting firebase_messaging. Reinstallation doesn't help


Additional context

Emulator: Pixel 4 API 30 (Android 11.0 | ARM64)


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand

[✓] Flutter (Channel stable, 3.16.9, on macOS 12.4 21F79 darwin-arm64, locale ru-RU) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc2) [!] Xcode - develop for iOS and macOS (Xcode 13.4) ✗ Flutter requires Xcode 14 or higher. Download the latest version or update via the Mac App Store. [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] IntelliJ IDEA Ultimate Edition (version 2022.1) [✓] VS Code (version 1.86.0) [✓] Connected device (3 available) [✓] Network resources


Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand

dependencies:

  • firebase_analytics 10.8.4 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
  • firebase_app_check 0.2.1+12 [firebase_app_check_platform_interface firebase_app_check_web firebase_core firebase_core_platform_interface flutter]
  • firebase_auth 4.17.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
  • firebase_core 2.25.4 [firebase_core_platform_interface firebase_core_web flutter meta]
  • firebase_crashlytics 3.4.13 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
  • firebase_messaging 14.7.15 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
  • firebase_performance 0.9.3+12 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter]
  • firebase_remote_config 4.3.12 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]

transitive dependencies:

  • _flutterfire_internals 1.3.21 [collection firebase_core firebase_core_platform_interface flutter meta]
  • firebase_analytics_platform_interface 3.9.4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
  • firebase_analytics_web 0.5.5+16 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
  • firebase_app_check_platform_interface 0.1.0+14 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
  • firebase_app_check_web 0.1.0+14 [_flutterfire_internals firebase_app_check_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
  • firebase_auth_platform_interface 7.1.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
  • firebase_auth_web 5.9.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta web]
  • firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
  • firebase_core_web 2.11.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta web]
  • firebase_crashlytics_platform_interface 3.6.20 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
  • firebase_messaging_platform_interface 4.5.23 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
  • firebase_messaging_web 3.6.4 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta web]
  • firebase_performance_platform_interface 0.1.4+20 [_flutterfire_internals firebase_core flutter plugin_platform_interface]
  • firebase_performance_web 0.1.4+20 [_flutterfire_internals firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins js]
  • firebase_remote_config_platform_interface 1.4.20 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
  • firebase_remote_config_web 1.4.20 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]

Geparder avatar Feb 07 '24 17:02 Geparder

Thanks for the bug report @Geparder Can you provide the entire crash log ? Also, can you run your scenario using plugin example and check if using it, you get same behavior or not ?

darshankawar avatar Feb 08 '24 11:02 darshankawar

LogCat

2024-02-08 17:03:34.059   512-597   InputDispatcher         system_server                        W  channel 'd28baf6 ...MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2024-02-08 17:03:34.059   512-597   InputDispatcher         system_server                        E  channel 'd28baf6 ....MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-02-08 17:03:34.063   512-3031  WindowManager           system_server                        I  WIN DEATH: Window{d28baf6 u0 ....MainActivity}
2024-02-08 17:03:34.068   512-3336  ActivityManager         system_server                        I  Process ... (pid 11938) has died: fg  TOP 

Example App not crash, but notifications don't arrive when the app is closed.

Geparder avatar Feb 08 '24 14:02 Geparder

@Geparder How are you sending the notifications ? Please try to use node js admin sdk to send and check. The plugin example has the script which uses node js through which notifications to be sent.

darshankawar avatar Feb 09 '24 11:02 darshankawar

i am using node js admin sdk

admin.messaging().send({ data: data, topic: profileId });

Geparder avatar Feb 09 '24 14:02 Geparder

but notifications don't arrive when the app is closed.

when you say app is closed, does it mean it is killed / terminated or in background / minimized ?

Can you confirm if this only occurs in debug or in release mode as well ?

When you install app for the first time, and then kill the app; The android debugger is still attached to it and it somehow restricts background services from running. That's not a firebase issue. If you try to run the app in release mode, can you confirm if this behaviour persists or not ?

darshankawar avatar Feb 12 '24 12:02 darshankawar

Hey @Geparder. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Feb 21 '24 02:02 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@Geparder if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Mar 01 '24 02:03 google-oss-bot

The application completely crashes. This only happens on one of my 3 emulators. They have not yet been taken to battle in this form. Quite dangerous.

In launch mode the application does not crash.

Geparder avatar Mar 15 '24 08:03 Geparder