Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'launchdarkly_flutter_client_sdk' channel sent a message from native to Flutter on a non-platform thread. #59

Open
hongfeiyang opened this issue Dec 18, 2023 · 10 comments

Comments

@hongfeiyang
Copy link

Is this a support request?
no

Describe the bug
[ERROR:flutter/shell/common/shell.cc(1015)] The 'launchdarkly_flutter_client_sdk' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.

To reproduce
just include launchdarkly_flutter_client_sdk in your project

Expected behavior
silence the warning

Logs
If applicable, add any log output related to your problem.

SDK version

  - LaunchDarkly (9.1.1):
    - LaunchDarkly/Core (= 9.1.1)
  - LaunchDarkly/Core (9.1.1):
    - LDSwiftEventSource (= 3.1.1)
  - launchdarkly_flutter_client_sdk (0.0.1):
    - Flutter
    - LaunchDarkly (= 9.1.1)

Language version, developer tools
Flutter 3.16.4, launch darkly 3.0.1

OS/platform
macOS latest as of today, XCode 15.1

Additional context
Add any other context about the problem here.

@tanderson-ld
Copy link
Contributor

Hello @hongfeiyang, thank you for reporting this issue.

How frequently are you seeing this issue as a total count and as a percentage of user sessions?

Did this issue begin appearing recently? Perhaps coinciding with updating Flutter or the LaunchDarkly SDK?

Thanks!

@hongfeiyang
Copy link
Author

Hello @hongfeiyang, thank you for reporting this issue.

How frequently are you seeing this issue as a total count and as a percentage of user sessions?

Did this issue begin appearing recently? Perhaps coinciding with updating Flutter or the LaunchDarkly SDK?

Thanks!

It happened recently. It's now appearing constantly when app launches. Maybe it's due to flutter's internal changes

@tanderson-ld
Copy link
Contributor

tanderson-ld commented Dec 19, 2023

Are you able to track down what changed recently in your code or dependencies that may have caused it? That will help tremendously in tracking this down. Thank you!

@michael-joseph-payne
Copy link

michael-joseph-payne commented Jan 9, 2024

I also saw this today for the first time, on iOS.

launchdarkly_flutter_client_sdk: ^2.0.0

Flutter 3.16.4 • channel stable • ssh://[email protected]/flutter/flutter.git
Framework • revision 2e9cb0aa71 (4 weeks ago) • 2023-12-11 14:35:13 -0700
Engine • revision 54a7145303
Tools • Dart 3.2.3 • DevTools 2.28.4

[LDEventSource] Initial reply received
[LDEventSource] State: connecting -> open
[ERROR:flutter/shell/common/shell.cc(1015)] The 'launchdarkly_flutter_client_sdk' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

I have not changed anything in the Launch Darkly code in our app for many months now because I don't have enough time to migrate to SDK 3+ right now.

@rodrigobastosv
Copy link

Same issue happening here:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.2.1 23C71 darwin-arm64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.88.0)
[✓] Connected device (3 available)
[✓] Network resources

@ohhyungkwon
Copy link

iOS plugin seems to have an issue. The completion handler should be wrapped by DispatchQueue.main.async like below.

let completion = { [weak self] in
  DispatchQueue.main.async {
      self?.channel.invokeMethod("completeStart", arguments: nil) 
  }
}
image

@tanderson-ld
Copy link
Contributor

Thanks @ohhyungkwon for providing more information. Are you seeing this in a reproducible manner?

@ohhyungkwon
Copy link

@tanderson-ld yes, it always happens to me.

@tanderson-ld
Copy link
Contributor

tanderson-ld commented Sep 18, 2024

Could you provide the following details?

  • Flutter Version
  • SDK Version
  • What situation your application is calling LDClient.start(...) in? (such as threading or services)

Thank you!

@ohhyungkwon
Copy link

SDK version

- LaunchDarkly (9.1.1):
    - LaunchDarkly/Core (= 9.1.1)
- LaunchDarkly/Core (9.1.1):
    - LDSwiftEventSource (= 3.1.1)
- launchdarkly_flutter_client_sdk (0.0.1):
    - Flutter
    - LaunchDarkly (= 9.1.1)
Flutter Channel stable, 3.22.3
Dart SDK version: 3.4.4

The flutter screen is launched as a module by native iOS app. I don't think I spawn any other thread when I call the launch darkly initialiser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants