This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Revert "Reland "iOS: Migrate FlutterEngine to ARC" (#55937)" #55954
Merged
jonahwilliams
merged 1 commit into
flutter:main
from
cbracken:revert-engine-arc-migration
Oct 18, 2024
Merged
Revert "Reland "iOS: Migrate FlutterEngine to ARC" (#55937)" #55954
jonahwilliams
merged 1 commit into
flutter:main
from
cbracken:revert-engine-arc-migration
Oct 18, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are still a couple closures where on engine shutdown, the last live reference to FlutterEngine may be on a thread other than the platform thread. Specifically, the profiling data capture callback can result in the last live reference to a FlutterEngine being on a profiling thread, resulting in an assertion failure in the destructor of the PlatformViewsController held by FlutterEngine, because PlatformViewsController holds a WeakPtrFactory whose destructor asserts that it be on the platform thread. See: https://github.com/flutter/engine/blob/ad9e4fef451a73427285826455db5fbdde502bd7/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm#L511-L515 Backtrace of such a crash: ``` ================================================================= Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview] PID: 46919, TID: 333147, Thread name: FlutterEngine.166.profiler, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libios_test_flutter.dylib 0x000000014b658aed -[FlutterTextInputPlugin dealloc] + 27 5 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 6 libios_test_flutter.dylib 0x000000014b63df5a -[FlutterEngine .cxx_destruct] + 135 7 libobjc.A.dylib 0x00007ff800035766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83 8 libobjc.A.dylib 0x00007ff80004ddfc objc_destructInstance + 61 9 CoreFoundation 0x00007ff8004a286b -[NSObject(NSObject) __dealloc_zombie] + 159 10 libios_test_flutter.dylib 0x000000014b635fea -[FlutterEngine dealloc] + 334 11 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 12 libios_test_flutter.dylib 0x000000014b63eda9 _ZNSt3_fl10__function6__funcIZ30-[FlutterEngine startProfiler]E3$_0NS_9allocatorIS2_EEFN7flutter13ProfileSampleEvEEclEv + 69 13 libios_test_flutter.dylib 0x000000014bcd8eaa _ZNSt3_fl10__function6__funcIZNK7flutter16SamplingProfiler16SampleRepeatedlyEN3fml9TimeDeltaEE3$_0NS_9allocatorIS6_EEFvvEEclEv + 40 14 libios_test_flutter.dylib 0x000000014b868786 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 156 15 libios_test_flutter.dylib 0x000000014b86ecca _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26 16 CoreFoundation 0x00007ff8003ea4a5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 17 CoreFoundation 0x00007ff8003ea032 __CFRunLoopDoTimer + 801 18 CoreFoundation 0x00007ff8003e97b6 __CFRunLoopDoTimers + 243 19 CoreFoundation 0x00007ff8003e4028 __CFRunLoopRun + 2108 20 CoreFoundation 0x00007ff8003e3409 CFRunLoopRunSpecific + 557 21 libios_test_flutter.dylib 0x000000014b86ee07 _ZN3fml17MessageLoopDarwin3RunEv + 65 22 libios_test_flutter.dylib 0x000000014b8686a4 _ZN3fml15MessageLoopImpl5DoRunEv + 22 23 libios_test_flutter.dylib 0x000000014b86dce5 _ZNSt3_fl10__function6__funcIZN3fml6ThreadC1ERKNS_8functionIFvRKNS3_12ThreadConfigEEEES7_E3$_0NS_9allocatorISC_EEFvvEEclEv + 135 24 libios_test_flutter.dylib 0x000000014b86da87 _ZZN3fml12ThreadHandleC1EONSt3_fl8functionIFvvEEEEN3$_08__invokeEPv + 27 25 libsystem_pthread.dylib 0x000000010d6a818b _pthread_start + 99 26 libsystem_pthread.dylib 0x000000010d6a3ae3 thread_start + 15 2024-10-18 09:31:27.549111-0700 IosUnitTests[46919:333147] [reports] Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview] PID: 46919, TID: 333147, Thread name: FlutterEngine.166.profiler, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libios_test_flutter.dylib 0x000000014b658aed -[FlutterTextInputPlugin dealloc] + 27 5 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 6 libios_test_flutter.dylib 0x000000014b63df5a -[FlutterEngine .cxx_destruct] + 135 7 libobjc.A.dylib 0x00007ff800035766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83 8 libobjc.A.dylib 0x00007ff80004ddfc objc_destructInstance + 61 9 CoreFoundation 0x00007ff8004a286b -[NSObject(NSObject) __dealloc_zombie] + 159 10 libios_test_flutter.dylib 0x000000014b635fea -[FlutterEngine dealloc] + 334 11 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 12 libios_test_flutter.dylib 0x000000014b63eda9 _ZNSt3_fl10__function6__funcIZ30-[FlutterEngine startProfiler]E3$_0NS_9allocatorIS2_EEFN7flutter13ProfileSampleEvEEclEv + 69 13 libios_test_flutter.dylib 0x000000014bcd8eaa _ZNSt3_fl10__function6__funcIZNK7flutter16SamplingProfiler16SampleRepeatedlyEN3fml9TimeDeltaEE3$_0NS_9allocatorIS6_EEFvvEEclEv + 40 14 libios_test_flutter.dylib 0x000000014b868786 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 156 15 libios_test_flutter.dylib 0x000000014b86ecca _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26 16 CoreFoundation 0x00007ff8003ea4a5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 17 CoreFoundation 0x00007ff8003ea032 __CFRunLoopDoTimer + 801 18 CoreFoundation 0x00007ff8003e97b6 __CFRunLoopDoTimers + 243 19 CoreFoundation 0x00007ff8003e4028 __CFRunLoopRun + 2108 20 CoreFoundation 0x00007ff8003e3409 CFRunLoopRunSpecific + 557 21 libios_test_flutter.dylib 0x000000014b86ee07 _ZN3fml17MessageLoopDarwin3RunEv + 65 22 libios_test_flutter.dylib 0x000000014b8686a4 _ZN3fml15MessageLoopImpl5DoRunEv + 22 23 libios_test_flutter.dylib 0x000000014b86dce5 _ZNSt3_fl10__function6__funcIZN3fml6ThreadC1ERKNS_8functionIFvRKNS3_12ThreadConfigEEEES7_E3$_0NS_9allocatorISC_EEFvvEEclEv + 135 24 libios_test_flutter.dylib 0x000000014b86da87 _ZZN3fml12ThreadHandleC1EONSt3_fl8functionIFvvEEEEN3$_08__invokeEPv + 27 25 libsystem_pthread.dylib 0x000000010d6a818b _pthread_start + 99 26 libsystem_pthread.dylib 0x000000010d6a3ae3 thread_start + 15 IosUnitTests(47009,0x10ec76240) malloc: enabling scribbling to detect mods to free blocks IosUnitTests(47009) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null) IosUnitTests(47009) MallocStackLogging: stack logs being written to /private/tmp/stack-logs.47009.1057b6000.IosUnitTests.0o4HgN.index IosUnitTests(47009) MallocStackLogging: recording malloc and VM allocation stacks to disk using standard recorder IosUnitTests(47009) MallocStackLogging: process 46919 no longer exists, stack logs deleted from /tmp/stack-logs.46919.10d1fc000.IosUnitTests.kFionm.index ``` This reverts commit 02fc8a4.
jonahwilliams
approved these changes
Oct 18, 2024
Contributor
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
loic-sharma
approved these changes
Oct 18, 2024
Contributor
|
Going to merge this to unblock the tree |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 18, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 19, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 19, 2024
jonahwilliams
pushed a commit
to flutter/flutter
that referenced
this pull request
Oct 19, 2024
…157215) flutter/engine@76d310e...dd37446 2024-10-19 [email protected] Move keymap from FlKeyboardViewDelegate to FlKeyboardManager (flutter/engine#55942) 2024-10-19 [email protected] [UI] fix scene builder parameter naming. (flutter/engine#55969) 2024-10-19 [email protected] iOS: Improve thread safety of first frame callback (flutter/engine#55966) 2024-10-18 [email protected] iOS: Fix flaky tests (remove timeouts) (flutter/engine#55961) 2024-10-18 [email protected] [Impeller] allocate the impeller onscreen texture from the render target cache. (flutter/engine#55943) 2024-10-18 [email protected] Roll Fuchsia Linux SDK from 9F_NaKPd2twhbPwP7... to tNQZ8d5mRYpe3--lk... (flutter/engine#55963) 2024-10-18 [email protected] Started filtering out close line segments in rrect polylines. (flutter/engine#55929) 2024-10-18 [email protected] [Impeller] libImpeller: Allow custom font registrations. (flutter/engine#55934) 2024-10-18 [email protected] Re-reland "iOS: Migrate FlutterEngine to ARC" (flutter/engine#55962) 2024-10-18 [email protected] [Impeller] libImpeller: Add a README. (flutter/engine#55940) 2024-10-18 [email protected] iOS: Eliminate needless profiler metrics ivar (flutter/engine#55957) 2024-10-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] one descriptor pool per frame. (#55939)" (flutter/engine#55959) 2024-10-18 [email protected] Revert "Reland "iOS: Migrate FlutterEngine to ARC" (#55937)" (flutter/engine#55954) 2024-10-18 [email protected] Roll Dart SDK from 993d3069f42e to a51df90298ca (7 revisions) (flutter/engine#55951) 2024-10-18 [email protected] [engine] add back opt out for merged threads. (flutter/engine#55952) 2024-10-18 [email protected] [Impeller] one descriptor pool per frame. (flutter/engine#55939) 2024-10-18 [email protected] [Impeller] add mechanism for sharing bdf inputs. (flutter/engine#55701) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from 9F_NaKPd2twh to tNQZ8d5mRYpe If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nick9822
pushed a commit
to nick9822/flutter
that referenced
this pull request
Dec 18, 2024
…lutter/engine#55954) There are still a couple closures where on engine shutdown, the last live reference to FlutterEngine may be on a thread other than the platform thread. Specifically, the profiling data capture callback can result in the last live reference to a FlutterEngine being on a profiling thread, resulting in an assertion failure in the destructor of the PlatformViewsController held by FlutterEngine, because PlatformViewsController holds a WeakPtrFactory whose destructor asserts that it be on the platform thread. See: https://github.com/flutter/engine/blob/f0f29ce37f235e6bf6734643e13932ce4c091311/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm#L511-L515 Backtrace of such a crash: ``` ================================================================= Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview] PID: 46919, TID: 333147, Thread name: FlutterEngine.166.profiler, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libios_test_flutter.dylib 0x000000014b658aed -[FlutterTextInputPlugin dealloc] + 27 5 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 6 libios_test_flutter.dylib 0x000000014b63df5a -[FlutterEngine .cxx_destruct] + 135 7 libobjc.A.dylib 0x00007ff800035766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83 8 libobjc.A.dylib 0x00007ff80004ddfc objc_destructInstance + 61 9 CoreFoundation 0x00007ff8004a286b -[NSObject(NSObject) __dealloc_zombie] + 159 10 libios_test_flutter.dylib 0x000000014b635fea -[FlutterEngine dealloc] + 334 11 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 12 libios_test_flutter.dylib 0x000000014b63eda9 _ZNSt3_fl10__function6__funcIZ30-[FlutterEngine startProfiler]E3$_0NS_9allocatorIS2_EEFN7flutter13ProfileSampleEvEEclEv + 69 13 libios_test_flutter.dylib 0x000000014bcd8eaa _ZNSt3_fl10__function6__funcIZNK7flutter16SamplingProfiler16SampleRepeatedlyEN3fml9TimeDeltaEE3$_0NS_9allocatorIS6_EEFvvEEclEv + 40 14 libios_test_flutter.dylib 0x000000014b868786 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 156 15 libios_test_flutter.dylib 0x000000014b86ecca _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26 16 CoreFoundation 0x00007ff8003ea4a5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 17 CoreFoundation 0x00007ff8003ea032 __CFRunLoopDoTimer + 801 18 CoreFoundation 0x00007ff8003e97b6 __CFRunLoopDoTimers + 243 19 CoreFoundation 0x00007ff8003e4028 __CFRunLoopRun + 2108 20 CoreFoundation 0x00007ff8003e3409 CFRunLoopRunSpecific + 557 21 libios_test_flutter.dylib 0x000000014b86ee07 _ZN3fml17MessageLoopDarwin3RunEv + 65 22 libios_test_flutter.dylib 0x000000014b8686a4 _ZN3fml15MessageLoopImpl5DoRunEv + 22 23 libios_test_flutter.dylib 0x000000014b86dce5 _ZNSt3_fl10__function6__funcIZN3fml6ThreadC1ERKNS_8functionIFvRKNS3_12ThreadConfigEEEES7_E3$_0NS_9allocatorISC_EEFvvEEclEv + 135 24 libios_test_flutter.dylib 0x000000014b86da87 _ZZN3fml12ThreadHandleC1EONSt3_fl8functionIFvvEEEEN3$_08__invokeEPv + 27 25 libsystem_pthread.dylib 0x000000010d6a818b _pthread_start + 99 26 libsystem_pthread.dylib 0x000000010d6a3ae3 thread_start + 15 2024-10-18 09:31:27.549111-0700 IosUnitTests[46919:333147] [reports] Main Thread Checker: UI API called on a background thread: -[UIView removeFromSuperview] PID: 46919, TID: 333147, Thread name: FlutterEngine.166.profiler, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libios_test_flutter.dylib 0x000000014b658aed -[FlutterTextInputPlugin dealloc] + 27 5 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 6 libios_test_flutter.dylib 0x000000014b63df5a -[FlutterEngine .cxx_destruct] + 135 7 libobjc.A.dylib 0x00007ff800035766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83 8 libobjc.A.dylib 0x00007ff80004ddfc objc_destructInstance + 61 9 CoreFoundation 0x00007ff8004a286b -[NSObject(NSObject) __dealloc_zombie] + 159 10 libios_test_flutter.dylib 0x000000014b635fea -[FlutterEngine dealloc] + 334 11 libobjc.A.dylib 0x00007ff800055228 _ZN11objc_object17sidetable_releaseEbb + 204 12 libios_test_flutter.dylib 0x000000014b63eda9 _ZNSt3_fl10__function6__funcIZ30-[FlutterEngine startProfiler]E3$_0NS_9allocatorIS2_EEFN7flutter13ProfileSampleEvEEclEv + 69 13 libios_test_flutter.dylib 0x000000014bcd8eaa _ZNSt3_fl10__function6__funcIZNK7flutter16SamplingProfiler16SampleRepeatedlyEN3fml9TimeDeltaEE3$_0NS_9allocatorIS6_EEFvvEEclEv + 40 14 libios_test_flutter.dylib 0x000000014b868786 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 156 15 libios_test_flutter.dylib 0x000000014b86ecca _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26 16 CoreFoundation 0x00007ff8003ea4a5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 17 CoreFoundation 0x00007ff8003ea032 __CFRunLoopDoTimer + 801 18 CoreFoundation 0x00007ff8003e97b6 __CFRunLoopDoTimers + 243 19 CoreFoundation 0x00007ff8003e4028 __CFRunLoopRun + 2108 20 CoreFoundation 0x00007ff8003e3409 CFRunLoopRunSpecific + 557 21 libios_test_flutter.dylib 0x000000014b86ee07 _ZN3fml17MessageLoopDarwin3RunEv + 65 22 libios_test_flutter.dylib 0x000000014b8686a4 _ZN3fml15MessageLoopImpl5DoRunEv + 22 23 libios_test_flutter.dylib 0x000000014b86dce5 _ZNSt3_fl10__function6__funcIZN3fml6ThreadC1ERKNS_8functionIFvRKNS3_12ThreadConfigEEEES7_E3$_0NS_9allocatorISC_EEFvvEEclEv + 135 24 libios_test_flutter.dylib 0x000000014b86da87 _ZZN3fml12ThreadHandleC1EONSt3_fl8functionIFvvEEEEN3$_08__invokeEPv + 27 25 libsystem_pthread.dylib 0x000000010d6a818b _pthread_start + 99 26 libsystem_pthread.dylib 0x000000010d6a3ae3 thread_start + 15 IosUnitTests(47009,0x10ec76240) malloc: enabling scribbling to detect mods to free blocks IosUnitTests(47009) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null) IosUnitTests(47009) MallocStackLogging: stack logs being written to /private/tmp/stack-logs.47009.1057b6000.IosUnitTests.0o4HgN.index IosUnitTests(47009) MallocStackLogging: recording malloc and VM allocation stacks to disk using standard recorder IosUnitTests(47009) MallocStackLogging: process 46919 no longer exists, stack logs deleted from /tmp/stack-logs.46919.10d1fc000.IosUnitTests.kFionm.index ``` This reverts commit 530a9f8. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I signed the [CLA]. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are still a couple closures where on engine shutdown, the last live reference to FlutterEngine may be on a thread other than the platform thread.
Specifically, the profiling data capture callback can result in the last live reference to a FlutterEngine being on a profiling thread, resulting in an assertion failure in the destructor of the PlatformViewsController held by FlutterEngine, because PlatformViewsController holds a WeakPtrFactory whose destructor asserts that it be on the platform thread.
See:
engine/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Lines 511 to 515 in ad9e4fe
Backtrace of such a crash:
This reverts commit 02fc8a4.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.