Skip to content

cherry-pick(4.4-stable): Android ANR deadlock between CSS updates-registry lock and Fabric commit (#9715)#9736

Merged
MatiPl01 merged 1 commit into
4.4-stablefrom
@matipl01/4.4-stable/cherry-pick-#9715
Jun 23, 2026
Merged

cherry-pick(4.4-stable): Android ANR deadlock between CSS updates-registry lock and Fabric commit (#9715)#9736
MatiPl01 merged 1 commit into
4.4-stablefrom
@matipl01/4.4-stable/cherry-pick-#9715

Conversation

@MatiPl01

Copy link
Copy Markdown
Member

…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).
@MatiPl01 MatiPl01 merged commit e90281d into 4.4-stable Jun 23, 2026
15 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/4.4-stable/cherry-pick-#9715 branch June 23, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants