React 19.2: a frozen boundary is re-rendered and re-committed in a loop (retry lanes rotate forever), starving timers and network callbacks
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 8/100
Direzione di ricerca
Start with the Freeze component's handling of its infinite thenable, then the React 19.2 retry-lane path in node_modules/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js (scheduleRetryEffect, claimNextRetryLane, getNextLanes). Reproduce by checking root.pendingLanes and root.suspendedLanes in a <Freeze freeze> subtree after a parent re-render. Done means the commit loop stops on React 19.2 and a maintainer has chosen between Activity-based hiding and a Freeze change; that choice is design work.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
On React 19.2 (sibling prerendering enabled), a <Freeze freeze> boundary that has committed its fallback is re-rendered and re-committed by React in a tight loop: the never-resolving thenable makes React claim a new retry lane on every commit, and getNextLanes immediately prerenders that lane again because it is suspended but never "warm". In a React Native app this saturates the JS thread (~400 commits/s measured) and starves everything that goes through the RN scheduler queue: timers, network callbacks, Fast Refresh. Touch events still arrive, so the app looks alive but nothing updates until the next tap.
We hit this through react-native-screens' freezeOnBlur on @react-navigation/bottom-tabs (every blurred tab is a permanently frozen subtree). Disabling freeze resolves it.
Environment
- react-freeze 1.0.4
- react 19.2.3, react-native 0.86.3 (bridgeless / Fabric), Hermes
- react-native-screens 4.26.2 (
DelayedFreeze→Freeze), @react-navigation/bottom-tabs 6.6.1 withfreezeOnBlur: true - Measured in Expo Go (SDK 57); the original report in our app came from a development build on device
Observations (measured in the running app via the Hermes CDP debugger and CPU profiler)
root.pendingLanesrotates through the retry lanes on successive reads:RetryLane3|4→RetryLane2|3→RetryLane1|2→RetryLane3|4…;suspendedLanesis always the previous retry lane;root.callbackNodeis a new task each time.- The only fibers holding those lanes are the
<Suspense>boundaries rendered byFreeze, all in fallback state (memoizedState !== null). - Hermes CPU profile over 6 s: JS thread saturated,
completeRoot(Fabric commit host function) is the top self-time entry, 2,578 React commits in the window. Call tree:performWorkOnRootViaSchedulerTask → performWorkOnRoot → renderRootConcurrent → commitRootWhenReady → commitRoot. - A 30 ms
setIntervalat app root got 0 ticks in 342 s; asetTimeout(fn, 0)fired after ~50 s;setImmediateand microtasks ran instantly; a DefaultLanesetStatecommitted within ~100 ms but did not stop the loop. - Any discrete input event (a tab tap, even on the selected tab) commits a SyncLane render and the loop stops, until the next render that reaches the frozen boundary (tab switch, parent re-render) restarts it.
Mechanism (react-native 0.86.3's ReactFabric-dev.js, React 19.2.3)
SuspenderthrowsinfiniteThenable = { then() {} }. The boundary commits in fallback.- Whenever that boundary completes while already in fallback,
scheduleRetryEffectcallsclaimNextRetryLane()and adds the lane toworkInProgressSuspendedRetryLanes. markRootFinishedputs the lane inroot.suspendedLanesbut notroot.warmLanes.getNextLanes: no unblocked lanes, no pinged lanes, so the sibling-prerendering branch picksnonIdlePendingLanes & ~warmLanesand renders it.- That render hits
Suspenderagain, but because the boundary was already showing the fallback it does not take therenderDidSuspendexit; the render completes, commits, and step 2 repeats.warmLanesis never set.
React 18 / 19.0 never scheduled a retry without a ping, so the infinite thenable was inert there. With sibling prerendering (19.1+), React assumes a suspended boundary will eventually ping, which is exactly the assumption Freeze breaks.
Reproduction
Any <Freeze freeze> subtree on React 19.2 should do it once a parent re-render reaches the boundary after the fallback has committed. The cleanest observation is __REACT_DEVTOOLS_GLOBAL_HOOK__.getFiberRoots(1) → root.pendingLanes / root.suspendedLanes rotating through 4194304 | 8388608 | 16777216 | 33554432 while no state changes, and a setInterval at the root that stops firing. I have not reduced it to a standalone repo yet; happy to if useful.
Possible directions
- React 19.2 ships
<Activity mode="hidden">, which is the non-Suspense way to get the same "keep state, stop rendering" behaviour and does not depend on a thenable that never resolves. - Short of that, a
thenthat at least records the ping callbacks and aFreezethat calls them on unfreeze would still not stop the prerender loop, since the loop happens while frozen; so a React-side issue may also be warranted. Filing here first because the assumption that a suspended boundary never pings isFreeze's design.
Related
- software-mansion/react-native-screens#2971 (JS FPS dropping to 20-40 with
freezeOnBluron bottom tabs, RN 0.79) looks like the same loop seen from the outside.
- Lingua principale
- TypeScript
- Stelle
- 1.7k
- Fork
- 45
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di software-mansion/react-freeze
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
software-mansion/react-freeze#38 · 6 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
software-mansion/react-freeze#37 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
software-mansion/react-freeze#35 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
software-mansion/react-freeze#31 · 6 commenti · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
software-mansion/react-freeze#30 · 1 commento ·
Tutte le issue di software-mansion/react-freeze
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
I maintainer di solito rispondono entro 1 giorno
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chatForse già presa @koeria l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
milind-soni/OpenMausBot#8023 ·
I maintainer di solito rispondono entro 1 giorno
-
Windows microphone listing treats words in a device name as DirectShow labelsForse già presa @Sujal-chaudhary l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
clipy-recorder/clipy#447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nightly-labs/openbot#19162 ·
I maintainer di solito rispondono entro 1 giorno
-
triage:in-progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Cotal-AI/Cotal#11229 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno