alibaba / flutter_boost

FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts
https://github.com/alibaba/flutter_boost
MIT License
6.97k stars 1.23k forks source link

[FBFlutterViewContainer surfaceUpdated:YES] 导致主线程暂停 #1871

Open ma125125t opened 1 year ago

ma125125t commented 1 year ago

我是使用的混合模式,从Native页面进入Flutter页面,Flutter页面中包含了一个PlatformView,在执行FBFlutterViewContainer的viewDidAppear时,主线程出现锁死,小概率,目前仅在我的App中可复现。

image

Flutter Boost Version:4.1.0 Target Platform:ALL Target OS version/browser:iOS Devices:ALL

Logs

add your crash log or something else.

[✓] Flutter (Channel stable, 3.7.6, on macOS 13.4 22F66 darwin-x64, locale zh-Hans-CN) • Flutter version 3.7.6 on channel stable at /Users/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 12cb4eb7a0 (4 months ago), 2023-03-01 10:29:26 -0800 • Engine revision ada363ee93 • Dart version 2.19.3 • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/fang/Library/Android/sdk • Platform android-33, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.12.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Community Edition (version 2022.3.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.80.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.68.0

[✓] Connected device (3 available) • iPhone (mobile) • c47e109191018678403d909c023e5339306f711d • ios • iOS 16.1 20B82 • macOS (desktop) • macos • darwin-x64 • macOS 13.4 22F66 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198 here.

ma125125t commented 1 year ago

[FBFlutterViewContainer viewDidAppear]中的surfaceUpdated方法有什么必要吗?我这边注释掉后也是正常运行的,这个方法应该不是线程安全的。和FlutterSDK中调用出现混乱的话,就有可能出现主线程卡死的情况。 可以麻烦解答下吗? @0xZOne

0xZOne commented 1 year ago

[FBFlutterViewContainer viewDidAppear]中的surfaceUpdated方法有什么必要吗?我这边注释掉后也是正常运行的,这个方法应该不是线程安全的。和FlutterSDK中调用出现混乱的话,就有可能出现主线程卡死的情况。 可以麻烦解答下吗? @0xZOne

谢谢反馈问题。我之前关注IOS端比较少,晚点我再核实一下,surfaceUpdated函数貌似有被重复调用的嫌疑~

lingjye commented 1 year ago

遇到了同样的问题,请问有后续吗?

yushu163 commented 1 year ago

遇到同样的问题,生产上已经出现多次,是否和https://github.com/flutter/flutter/issues/94524 这个相关 @0xZOne

ameryzhu commented 1 year ago

遇到了同样的问题,首页经常出现原生切flutterboost页面卡死的情况。

rzrobert commented 7 months ago

我也遇到过,bugly每月捕捉几百个,不知道怎么解,一直被催。

0
libsystem_kernel.dylib
___psynch_cvwait + 8
1
libsystem_pthread.dylib
__pthread_cond_wait$VARIANT$mp + 1240
2
Flutter
0x0000000105088000 + 350112
3
Flutter
0x0000000105088000 + 4005808
4
flutter_boost
-[FBFlutterViewContainer surfaceUpdated:] + 148
5
Flutter
0x0000000105088000 + 191880
6
flutter_boost
-[FBFlutterViewContainer viewDidLayoutSubviews] + 40
imcjj commented 2 months ago

使用4.6.3版本,应该就可以解决这个问题了。