Remove sync call from DetachRootView to fix deadlock, add public QuirkSettings API for backward compatibility#15113
Conversation
…ll with async Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
|
/azp run |
|
@copilot run "yarn change" prerelease and "yarn lint:fix" and "yarn format" |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
I've completed the requested tasks:
The change file has been created for versioning and all code formatting is correct. Committed in 144551a. |
…n to re-enable if needed Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a deadlock issue in DetachRootView by removing a synchronous call that could block during Hermes garbage collection operations. The solution maintains backward compatibility by adding a public quirk setting to re-enable the legacy behavior if needed.
Key changes:
- Replaced synchronous
runOnQueueSynccall with conditional execution based on quirk setting - Added comprehensive QuirkSettings API for the new
EnableSyncDetachRootViewoption - Updated project files to include the new QuirkSettings implementation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ReactInstanceWin.cpp | Modified DetachRootView to conditionally execute sync call based on quirk setting |
| QuirkSettings.idl | Added IDL definition for EnableSyncDetachRootView quirk option |
| QuirkSettings.h | Added header declarations for the new quirk setting methods |
| QuirkSettings.cpp | Implemented quirk setting getter/setter methods and property definitions |
| Microsoft.ReactNative.vcxproj | Added QuirkSettings source files to project compilation |
| change/*.json | Added change log entries for the deadlock fix and API changes |
992246d to
4642723
Compare
|
/azp run |
|
@copilot update PR description as per react-native-windows PR template |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Updated the PR description to follow the react-native-windows PR template format with proper sections for Description, Type of Change, Why, What, Screenshots, Testing, and Changelog. |
@copilot the pr description should follow the latest code changes |
Updated the PR description to reflect the latest code changes with QuirkSettings.SetUseRunOnQueueSync instead of the old EnableSyncDetachRootView approach. |
Description
Type of Change
Why
This PR addresses a deadlock issue in ReactInstanceWin::DetachRootView that occurs when the UI thread calls runOnQueueSync during Hermes garbage collection operations. The deadlock happens because:
runOnQueueSync()and blocks waiting for the JS thread to respondmarkRootswhich hold internal locksResolves #15109
What
SetUseRunOnQueueSync(defaults to false) for backward compatibilityThe change eliminates the deadlock while providing a safety net through QuirkSettings::SetUseRunOnQueueSync(settings, true) if the removal breaks existing applications.
Screenshots
N/A - This is a runtime deadlock fix with no UI changes.
Testing
Changelog
Should this change be included in the release notes: yes
Add a brief summary of the change to use in the release notes for the next release.
Fixed deadlock in ReactInstanceWin::DetachRootView during Hermes garbage collection by removing synchronous call. Added QuirkSettings.SetUseRunOnQueueSync option for backward compatibility if needed.
Microsoft Reviewers: Open in CodeFlow