Skip to content

Fix callback and promise teardown races (#59670) - #59670

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D128581452
Open

javache wants to merge 1 commit into
react:mainfrom
javache:export-D128581452

Conversation

@javache

@javache javache commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in #59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452

@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 Oct 30, 2026
@meta-codesync

meta-codesync Bot commented Oct 30, 2026

Copy link
Copy Markdown

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

@meta-codesync meta-codesync Bot changed the title Fix callback and promise teardown races Fix callback and promise teardown races (#59670) Oct 30, 2026
javache added a commit to javache/react-native that referenced this pull request Oct 30, 2026
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452
javache added a commit to javache/react-native that referenced this pull request Oct 30, 2026
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452
javache added a commit to javache/react-native that referenced this pull request Oct 30, 2026
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452
javache added a commit to javache/react-native that referenced this pull request Oct 30, 2026
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452
javache added a commit to javache/react-native that referenced this pull request Oct 30, 2026
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452
Summary:
Pull Request resolved: react#59670

Keep JavaScript callback and promise values rooted while native owners retain weak lifetime handles. Release inline on the JavaScript thread and dispatch only off-thread cleanup, preventing native invocation or destruction from retaining these values across runtime teardown. Apply the same ownership policy to asynchronous callbacks and promises.

This builds on the investigation and reproducer contributed by HyunWoo Lee in react#59579.

Changelog:
[General][Fixed] - Fix TurboModule callback and async promise cleanup racing runtime teardown
[General][Deprecated] - Deprecate CallbackWrapper in favour of LongLivedObjectHandle

Differential Revision: D128581452

This branch has not been deployed

No deployments
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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant