-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#30835Closed
Copy link
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolec: fatal crashCrashes that terminate the processCrashes that terminate the processengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
I am using the Flutter 2.5.3, But after Flutter upgrade, I met the Mutex Lock Failed crash. In order to resolve this crash, I decide to apply below changes according to this Fix PR:
// FlutterViewController+Patch.m
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
SEL origSel = @selector(setupNotificationCenterObservers);
SEL swizSel = @selector(fix_setupNotificationCenterObservers);
Method origMethod = class_getInstanceMethod([self class], origSel);
Method swizMethod = class_getInstanceMethod([self class], swizSel);
method_exchangeImplementations(origMethod, swizMethod);
});
}
- (void)fix_setupNotificationCenterObservers {
[self fix_setupNotificationCenterObservers];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillTerminate:)
name:UIApplicationWillTerminateNotification
object:nil];
}
- (void)applicationWillTerminate:(NSNotification*)notification {
BOOL performPatch = NO;
id delegate = UIApplication.sharedApplication.delegate;
if ([delegate respondsToSelector:@selector(isDestroyContext)]) {
performPatch = [delegate performSelector:@selector(isDestroyContext)];
}
if (!performPatch) {
return;
}
if (![self respondsToSelector:@selector(goToApplicationLifecycle:)]) {
return;
}
[self goToApplicationLifecycle:@"AppLifecycleState.detached"];
[self.engine destroyContext];
}After applying these changes to My Project, a new crash are random reported, you can checkout the stacktrack detail at below section.
Expected results:
There is no crash when teminating.
Actual results:
Crashed: com.apple.main-thread
0 Flutter 0x34531c flutter::Shell::OnPlatformViewSetSemanticsEnabled(bool) + 4512371484
1 Flutter 0x41d0c flutter::PlatformViewIOS::~PlatformViewIOS() + 4509211916
2 Flutter 0x3fac0 flutter::PlatformViewIOS::~PlatformViewIOS() + 4509203136
3 Flutter 0x353618 std::__1::__function::__func<fml::internal::CopyableLambda<flutter::Shell::~Shell()::$_6>, std::__1::allocator<fml::internal::CopyableLambda<flutter::Shell::~Shell()::$_6> >, void ()>::operator()() + 4512429592
4 Flutter 0x353000 flutter::Shell::~Shell() + 4512428032
5 Flutter 0x16288 std::__1::unique_ptr<flutter::Shell, std::__1::default_delete<flutter::Shell> >::reset(flutter::Shell*) + 4509033096
6 Flutter 0x12850 -[FlutterEngine destroyContext] + 4509018192
7 Binance 0x5240 -[FlutterViewController(Patch) applicationWillTerminate:] + 52 (FlutterViewController+Patch.m:52)
8 CoreFoundation 0x2af88 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
9 CoreFoundation 0xc6c3c ___CFXRegistrationPost_block_invoke + 52
10 CoreFoundation 0x99ff4 _CFXRegistrationPost + 456
11 CoreFoundation 0x40df4 _CFXNotificationPost + 716
12 Foundation 0x1af68 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
13 UIKitCore 0xf54654 -[UIApplication _terminateWithStatus:] + 300
14 UIKitCore 0x63cb38 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128
15 UIKitCore 0x831a80 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 224
16 UIKitCore 0xf5129c -[UIApplication workspaceShouldExit:withTransitionContext:] + 212
17 FrontBoardServices 0x4f780 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 80
18 FrontBoardServices 0xa06c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240
19 FrontBoardServices 0x4f718 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 132
20 libdispatch.dylib 0x4670 _dispatch_client_callout + 20
21 libdispatch.dylib 0x8128 _dispatch_block_invoke_direct + 264
22 FrontBoardServices 0xb9c4 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
23 FrontBoardServices 0xad8c -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
24 FrontBoardServices 0xf414 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
25 CoreFoundation 0xbb0d0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
26 CoreFoundation 0xcbd90 __CFRunLoopDoSource0 + 208
27 CoreFoundation 0x6104 __CFRunLoopDoSources0 + 376
28 CoreFoundation 0xb8a4 __CFRunLoopRun + 820
29 CoreFoundation 0x1f468 CFRunLoopRunSpecific + 600
30 GraphicsServices 0x138c GSEventRunModal + 164
31 UIKitCore 0x51a088 -[UIApplication _run] + 1100
32 UIKitCore 0x298958 UIApplicationMain + 2092
33 Binance 0x5890 main + 14 (main.swift:14)
34 ??? 0x10ab4daa4 (缺少)
Code sample
Logs
[✓] Flutter (Channel unknown, 2.5.3, on macOS 11.6.1 20G224 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.5.3 at /Users/user/.flutter_wrapper/2.5.3
• Upstream repository unknown
• Framework revision 18116933e7 (2 months ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.2.1, Build version 13C100
• CocoaPods version 1.11.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] 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/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.63.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.29.0
[✓] Connected device (2 available)
• iPhone 8 (mobile) • 79EED0F4-1973-465C-9169-9BAA07880B38 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
! Doctor found issues in 2 categories.
brunovsiqueira, marcos930807, BansookNam, liaufan, sgr-ksmt and 17 more
Metadata
Metadata
Assignees
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolec: fatal crashCrashes that terminate the processCrashes that terminate the processengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version