Skip to content

Add enableSchedulerDelegateInvalidation feature flag (#56678)#56678

Closed
fkgozali wants to merge 1 commit intofacebook:mainfrom
fkgozali:export-D103757271
Closed

Add enableSchedulerDelegateInvalidation feature flag (#56678)#56678
fkgozali wants to merge 1 commit intofacebook:mainfrom
fkgozali:export-D103757271

Conversation

@fkgozali
Copy link
Copy Markdown
Contributor

@fkgozali fkgozali commented May 4, 2026

Summary:

Introduces a new common React Native feature flag, enableSchedulerDelegateInvalidation, that gates a defensive guard around Scheduler::uiManagerDidDispatchCommand and uiManagerDidFinishTransaction. Those call sites enqueue a lambda via runtimeScheduler_->scheduleRenderingUpdate that captures the raw SchedulerDelegate pointer by value. With RuntimeScheduler_Modern (bridgeless) the lambda runs asynchronously, so if the SchedulerDelegate is destroyed between enqueue and execution the lambda dereferences dangling memory and the process crashes (EXC_BAD_ACCESS / KERN_INVALID_ADDRESS). The follow-up commit adds the actual guard wired to this flag.

Defaults to false so behavior is unchanged on landing. Apps opt in by overriding the flag in their own ReactNativeFeatureFlagsDefaults subclass.

Includes the regenerated feature-flag boilerplate (Kotlin/Java/Cxx accessors, defaults, providers, JS spec, native module) emitted by yarn featureflags --update.

Changelog:
[Internal]

Reviewed By: shwanton

Differential Revision: D103757271

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 4, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 4, 2026

@fkgozali has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103757271.

@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels May 4, 2026
@meta-codesync meta-codesync Bot changed the title Add enableSchedulerDelegateInvalidation feature flag Add enableSchedulerDelegateInvalidation feature flag (#56678) May 4, 2026
@fkgozali fkgozali force-pushed the export-D103757271 branch from 710a630 to 63569f7 Compare May 4, 2026 23:54
Summary:

Introduces a new common React Native feature flag, `enableSchedulerDelegateInvalidation`, that gates a defensive guard around `Scheduler::uiManagerDidDispatchCommand` and `uiManagerDidFinishTransaction`. Those call sites enqueue a lambda via `runtimeScheduler_->scheduleRenderingUpdate` that captures the raw `SchedulerDelegate` pointer by value. With `RuntimeScheduler_Modern` (bridgeless) the lambda runs asynchronously, so if the `SchedulerDelegate` is destroyed between enqueue and execution the lambda dereferences dangling memory and the process crashes (`EXC_BAD_ACCESS` / `KERN_INVALID_ADDRESS`). The follow-up commit adds the actual guard wired to this flag.

Defaults to `false` so behavior is unchanged on landing. Apps opt in by overriding the flag in their own `ReactNativeFeatureFlagsDefaults` subclass.

Includes the regenerated feature-flag boilerplate (Kotlin/Java/Cxx accessors, defaults, providers, JS spec, native module) emitted by `yarn featureflags --update`.

Changelog:
[Internal]

Reviewed By: shwanton

Differential Revision: D103757271
@fkgozali fkgozali force-pushed the export-D103757271 branch from 63569f7 to c5565e7 Compare May 5, 2026 02:37
@meta-codesync meta-codesync Bot closed this in d0672fb May 5, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label May 5, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 5, 2026

This pull request has been merged in d0672fb.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @fkgozali in d0672fb

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants