Skip to content

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

Merged
MatiPl01 merged 2 commits into
4.3-stablefrom
@matipl01/4.3-stable/fix-css-commit-deadlock
Jul 3, 2026
Merged

cherry-pick(4.3-stable): Android ANR deadlock between CSS updates-registry lock and Fabric commit (#9715)#9849
MatiPl01 merged 2 commits into
4.3-stablefrom
@matipl01/4.3-stable/fix-css-commit-deadlock

Conversation

@MatiPl01

@MatiPl01 MatiPl01 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Cherry-picking for Reanimated 4.3.2 release

The original commit doesn't apply to 4.3-stable, so this PR ports the analogous fix. Two adjustments: there's no USE_ANIMATION_BACKEND branch (4.3 has no animation backend), and the snapshot map gets its own mutex because 4.3 also resolves relative lengths on the JS thread, outside the registry lock.

…he commit deadlock

Resolving a relative CSS length (e.g. a transformOrigin mixing % and px)
read the live ShadowTree, which takes the ShadowTree commit lock, while
the CSS flush holds the updates-registry lock; a concurrent Fabric
commit takes the same two locks in the opposite order, so they deadlock
(AB-BA) when RN's preventShadowTreeCommitExhaustion flag holds the
commit lock across the commit hooks. This branch got that lock shape
with #9323, which replaced the per-registry flush locks with the single
updates-registry lock the commit hook also takes.

Port of #9715's approach to 4.3: ReanimatedMountHook records the
mounted root per surface and ViewStylesRepository resolves nodes from
that snapshot via plain tree walks, so the read path never takes the
ShadowTree lock. Unlike main, transition setup here resolves relative
lengths on the JS thread without the updates-registry lock, so the
snapshot map is guarded by its own leaf mutex.
@MatiPl01 MatiPl01 merged commit 5d38250 into 4.3-stable Jul 3, 2026
21 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/4.3-stable/fix-css-commit-deadlock branch July 3, 2026 06:53
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