Remove enableMainQueueCoordinatorOnIOS, make coordinator always-on#56935
Open
javache wants to merge 5 commits into
Open
Remove enableMainQueueCoordinatorOnIOS, make coordinator always-on#56935javache wants to merge 5 commits into
javache wants to merge 5 commits into
Conversation
Summary: Replace the `std::mutex` + `std::condition_variable` + `std::shared_ptr<bool>` trio that gates the JS thread on main-queue module construction with a single `dispatch_semaphore_t`. The wait block is invoked exactly once (from `_loadScriptFromSource:`'s `beforeLoad` lambda), so single-shot semaphore semantics fit the contract directly — no condition predicate, no shared state captured by three independent `shared_ptr`s. Net: 12 lines deleted, 1 captured object instead of 3, no behavior change. Changelog: [Internal] Differential Revision: D105953979
…always-on Summary: The `enableEagerMainQueueModulesOnIOS` runtime gate has finished rollout and is no longer needed. Drop the flag from the feature-flag config, regenerate the per-language accessors, and inline the previously-gated body in `RCTInstance._start` so the eager main-queue module setup always runs. Also drops the now-dead override and trims the test that exercised the flag-off branch. After this change, when `RCTInstance` starts up, it always consults `RCTInstanceDelegate.unstableModulesRequiringMainQueueSetup`, initializes the returned modules on the main queue, and blocks the JS thread on that completion before evaluating the bundle. Changelog: [iOS][Changed] - Native modules listed in `unstableModulesRequiringMainQueueSetup` are now always initialized eagerly on the main queue during React Native init; the previous `enableEagerMainQueueModulesOnIOS` opt-in flag has been removed. Differential Revision: D105954235
Summary: The \`enableVirtualViewDebugFeatures\` feature flag was effectively dead — its only MobileConfig backing param (\`rn_fling.fling_debug\`) hadn't been updated in 365+ days, and the codemod-tracking diff D105936405 was already queued to remove the three native overrides. Rather than carry the FF + JS overlay surface forward, delete the whole stack: the FF, the overrides, the BUCK dep, the JS overlay components (\`FlingItemOverlay\`, \`FlingDebugItemOverlay\`, \`FlingDebugOverlay\`), the debug-log helpers in the native ScrollView/VirtualView implementations on both iOS and Android, and the now-orphaned references in \`VirtualCollectionView\`. Net: 4 files deleted, the FF removed from the cross-language codegen, native debug logging dropped from 5 files (1 ObjC++, 4 Kotlin), and consumer code in \`VirtualCollectionView\` simplified. Changelog: [General][Removed] - Remove unused \`enableVirtualViewDebugFeatures\` feature flag and the associated \`FlingItemOverlay\` / \`FlingDebugItemOverlay\` debug surfaces. Differential Revision: D105959433
Summary: The \`enableMainQueueCoordinatorOnIOS\` flag swaps two non-trivial threading primitives — \`RCTUnsafeExecuteOnMainQueueSync\` uses either \`dispatch_sync(main, ...)\` or \`unsafeExecuteOnMainThreadSync\`, and \`executeSynchronouslyOnSameThread_CAN_DEADLOCK\` switches between \`saferExecuteSynchronouslyOnSameThread_CAN_DEADLOCK\` and the legacy variant. There was zero in-tree test coverage for either branch. Adds three characterization tests: - \`testRCTUnsafeExecuteOnMainQueueSync_flagOff_runsBlockOnMainFromBG\` and \`...flagOn_...\` pin the basic contract for both branches: from a background thread, the block runs on the main queue and the call returns synchronously. - \`testExecuteSynchronouslyOnSameThread_flagOn_pumpsUITasksWhileWaitingForJS\` is the coordinator's signature property: while the main thread is blocked in the safer impl's wait loop, a UI task posted from a background thread is pumped before the runtime work resumes. The test wires a deliberately slow \`RuntimeExecutor\` (300ms sleep before invoking its callback) so a BG thread can post a \`RCTUnsafeExecuteOnMainQueueSync\` work item during the window, then asserts the ordering via a monotonic sequence counter. Changelog: [Internal] Differential Revision: D105972787
Summary: The `enableMainQueueCoordinatorOnIOS` flag has finished rollout. Drop it from the feature-flag config, regenerate the per-language accessors, and inline the previously-gated paths: - `RCTUtils.mm`: `RCTUnsafeExecuteOnMainQueueSync` and the `RCTUnsafeExecuteOnMainQueueOnceSync` helper always use `unsafeExecuteOnMainThreadSync` on iOS (the TV fallback to `dispatch_sync(main, ...)` stays). - `RuntimeExecutorSyncUIThreadUtils.mm`: `executeSynchronouslyOnSameThread_CAN_DEADLOCK` switches between two paths based on the calling thread instead of the feature flag. Main-thread callers (production) take the coordinator path that pumps UI tasks while waiting for JS; off-main callers (e.g. RuntimeScheduler unit tests) take a simpler path that just waits for the runtime and runs `runtimeWork` synchronously on the calling thread. Trimmed the `runtimeCaptureBlockDone` plumbing that an old TODO already flagged as unnecessary. Also drops the iOS override in the Wilde plugin, the now-dead `rn_fling.enable_main_queue_coordinator_on_ios` MobileConfig param, and the `flagOff` variant of the characterization test (the on-path test still pins the contract). Changelog: [iOS][Changed] - `RCTUnsafeExecuteOnMainQueueSync` and bridgeless sync runtime-thread calls now always use the coordinator implementation that pumps UI tasks while waiting for JS, eliminating a class of deadlocks. The previous opt-in flag has been removed. Differential Revision: D105984547
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105984547. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
The
enableMainQueueCoordinatorOnIOSflag has finished rollout. Drop it from the feature-flag config, regenerate the per-language accessors, and inline the previously-gated paths:RCTUtils.mm:RCTUnsafeExecuteOnMainQueueSyncand theRCTUnsafeExecuteOnMainQueueOnceSynchelper always useunsafeExecuteOnMainThreadSyncon iOS (the TV fallback todispatch_sync(main, ...)stays).RuntimeExecutorSyncUIThreadUtils.mm:executeSynchronouslyOnSameThread_CAN_DEADLOCKswitches between two paths based on the calling thread instead of the feature flag. Main-thread callers (production) take the coordinator path that pumps UI tasks while waiting for JS; off-main callers (e.g. RuntimeScheduler unit tests) take a simpler path that just waits for the runtime and runsruntimeWorksynchronously on the calling thread. Trimmed theruntimeCaptureBlockDoneplumbing that an old TODO already flagged as unnecessary.Also drops the iOS override in the Wilde plugin, the now-dead
rn_fling.enable_main_queue_coordinator_on_iosMobileConfig param, and theflagOffvariant of the characterization test (the on-path test still pins the contract).Changelog:
[iOS][Changed] -
RCTUnsafeExecuteOnMainQueueSyncand bridgeless sync runtime-thread calls now always use the coordinator implementation that pumps UI tasks while waiting for JS, eliminating a class of deadlocks. The previous opt-in flag has been removed.Differential Revision: D105984547