Skip to content

[linux, engine]: can't reuse event channel with same name on Linux #126209

@Gustl22

Description

@Gustl22

Is there an existing issue for this?

Steps to reproduce

Expected results

It should not fail.

The main question is: "Should platform channels with the same name be reusable". It's hard to write platform channel tests for our lib, as each test should be executeable independently. But that's not possible for the native side. As it always involves some initialization and deserialization / disposing, which lives in the same process for the whole test execution. Therefor it should be possible to use the exact same name for a previously disposed event channel.

Actual results

MissingPluginException(No implementation found for method listen on channel xyz.luan/audioplayers/events/somePlayerId)

See: https://github.com/bluefireteam/audioplayers/actions/runs/4903980917/jobs/8756730803

If I explicitely remove the channel from the binary messenger, the tests pass:

  fl_binary_messenger_set_message_handler_on_channel(
          binaryMessenger, ("xyz.luan/audioplayers/events/" + playerId).c_str(), nullptr, nullptr, nullptr);

But this should be done via g_clear_object already.

Also see: flutter/engine#21316 (comment)

Code sample

Code sample

It's not minimal, but it is not really necessary / hard to setup, as it involves platform channels.
https://github.com/bluefireteam/audioplayers/blob/fbc658d2f69d581d2ca15c81c535047263fbfdf2

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
  The following MissingPluginException was thrown while activating platform stream on channel
  xyz.luan/audioplayers/events/somePlayerId:
  MissingPluginException(No implementation found for method listen on channel
  xyz.luan/audioplayers/events/somePlayerId)
  
  When the exception was thrown, this was the stack:
  #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
  <asynchronous suspension>
  <asynchronous suspension>
  (elided one frame from package:stack_trace)
  ════════════════════════════════════════════════════════════════════════════════════════════════════
  ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
  The following MissingPluginException was thrown while de-activating platform stream on channel
  xyz.luan/audioplayers/events/somePlayerId:
  MissingPluginException(No implementation found for method cancel on channel
  xyz.luan/audioplayers/events/somePlayerId)
  
  When the exception was thrown, this was the stack:
  #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
  <asynchronous suspension>
  <asynchronous suspension>
  (elided one frame from package:stack_trace)
  ════════════════════════════════════════════════════════════════════════════════════════════════════
  ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
  The following message was thrown:
  Multiple exceptions (2) were detected during the running of the current test, and at least one was
  unexpected.
  ════════════════════════════════════════════════════════════════════════════════════════════════════
  Test failed. See exception logs above.
  The test description was: Reuse same platform event channel id

See: https://github.com/bluefireteam/audioplayers/actions/runs/4903980917/jobs/8756730803

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.0, on Ubuntu 22.04.2 LTS 5.15.0-71-generic, locale en_US.UTF-8)
    • Flutter version 3.7.0 on channel stable at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (3 months ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/gustl/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT = /home/gustl/Android/Sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu122.04)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at /snap/intellij-idea-ultimate/426
    • Flutter plugin version 73.0.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.2 LTS 5.15.0-71-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.121

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Also see: flutter/engine#21316 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: pluginsSupport for writing, building, and running plugin packagesengineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specificallyteam-linuxOwned by the Linux platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions