cherry-pick(4.4-stable): Android ANR deadlock between CSS updates-registry lock and Fabric commit (#9715)#9736
Merged
Conversation
…c commit (#9715) ## Issue On Android, screens using a relative CSS length (e.g. a `transformOrigin` mixing `%` and `px`) could freeze (ANR). Resolving the relative length read the live ShadowTree, which takes the ShadowTree commit lock, while holding Reanimated's updates-registry lock; a concurrent Fabric commit takes the same two locks in the opposite order, so they deadlock (AB-BA). Regression from #9495. ## Fix Resolve relative lengths against the last mounted tree instead of the live ShadowTree, so the read path never takes the ShadowTree lock. `ReanimatedMountHook` records the mounted root per surface (under the registry lock it already holds), and `ViewStylesRepository` reads layout from that snapshot via a plain parent/child walk. With lock A gone from Reanimated's read path, the AB-BA cycle can't form. Animation-backend mode keeps reading the live tree (its commit hook is disabled there, so there is no deadlock to avoid). Verified on device: Android (deadlock gone) and iOS (relative resolution correct).
tjzel
approved these changes
Jun 23, 2026
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
Cherry-picking for Reanimated 4.4.2 release