Repository navigation
Conversation
Summary: Fix a crash in `SurfaceMountingManager.updateOverflowInset()` where `getViewState()` throws `RetryableMountingLayerException` when the view state for a tag is not found in the registry. The crash occurs during batch mount item execution when an `updateOverflowInset` operation references a view tag that has been removed from the registry due to normal lifecycle race conditions. The surface is still active (not stopped), but the view has already been deleted. The fix replaces `getViewState(reactTag)` (which throws) with `getNullableViewState(reactTag)` + null check + soft exception logging + early return. This matches the defensive pattern already used by peer methods in the same class: `updateLayout`, `addViewAt`, and `removeViewAt`. Logview link: [252c85116a7ab5c4ec93ef3c3373cf9d](https://www.internalfb.com/logview/system_vros_crashes/252c85116a7ab5c4ec93ef3c3373cf9d) Differential Revision: D104400233
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104400233. |
cortinico
approved these changes
May 11, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Collaborator
|
This pull request was successfully merged by @javache in dabb434 When will my fix make it into a release? | How to file a pick request? |
3 tasks
cipolleschi
pushed a commit
that referenced
this pull request
Aug 24, 2026
) Summary: Pull Request resolved: #56762 Fix a crash in `SurfaceMountingManager.updateOverflowInset()` where `getViewState()` throws `RetryableMountingLayerException` when the view state for a tag is not found in the registry. The crash occurs during batch mount item execution when an `updateOverflowInset` operation references a view tag that has been removed from the registry due to normal lifecycle race conditions. The surface is still active (not stopped), but the view has already been deleted. The fix replaces `getViewState(reactTag)` (which throws) with `getNullableViewState(reactTag)` + null check + soft exception logging + early return. This matches the defensive pattern already used by peer methods in the same class: `updateLayout`, `addViewAt`, and `removeViewAt`. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D104400233 fbshipit-source-id: 678df406079da98c0c2180766c936b5f2bb9fcf7
Collaborator
|
This pull request was successfully merged by @javache in 09dcc63 When will my fix make it into a release? | How to file a pick request? |
delekta
added a commit
to discord/react-native
that referenced
this pull request
Nov 23, 2026
…updateState and updateOverflowInset (#66) * Handle missing viewState gracefully in SurfaceMountingManager.updateState and updatePadding (react#57181) Summary: Pull Request resolved: react#57181 ## Summary Fixes `RetryableMountingLayerException: Unable to find viewState for tag N. Surface stopped: false` crashing `com.oculus.firsttimenux` from the Fabric batch-mount path. Logview link: [252c85116a7ab5c4ec93ef3c3373cf9d](https://www.internalfb.com/logview/system_vros_crashes/252c85116a7ab5c4ec93ef3c3373cf9d) ## Root cause `IntBufferBatchMountItem.execute` dispatches batched mount instructions. When a view tag is transiently missing from the registry (async race between the JS commit and native mount — surface teardown / out-of-order delivery), mount methods that call the throwing `getViewState` raise `RetryableMountingLayerException`. `MountItemDispatcher.dispatchMountItems` only retries this exception `if (item is DispatchCommandMountItem)` (comment: *"Only DispatchCommandMountItem supports retries"*) — `IntBufferBatchMountItem` is not one, so the "retryable" exception propagates uncaught and crashes the app. The RN team has been hardening each batch mount method to handle missing viewState gracefully (soft-log + early return): `addViewAt` in `D99760257` (which references this same MID and process), `updateOverflowInset` in `D104400233`; `removeViewAt`, `updateProps`, `updateLayout`, and `deleteView` were already graceful. The originally-reported `addViewAt` stack is therefore already fixed in trunk — crashes persist on release branch v201/v203 which predates `D99760257`. `updateState` (`INSTRUCTION_UPDATE_STATE`) and `updatePadding` (`INSTRUCTION_UPDATE_PADDING`) were the two remaining throwing `getViewState` callers reachable from `IntBufferBatchMountItem.execute` — unfixed siblings of the same multi-site pattern and live/contributing crash sites for the same exception. ## Fix Change `updateState` and `updatePadding` to use `getNullableViewState`; on null, log a `SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE` soft exception and return early — identical to the established pattern in `addViewAt`, `updateOverflowInset`, `updateProps`, `updateLayout`, and `deleteView`. This is not a throw-downgrade of an invariant: `RetryableMountingLayerException` is an explicitly retryable transient signal, and this matches the canonical handling the RN team applies to every other batch mount method. The non-batch callers (`sendAccessibilityEvent`, `setJSResponder`) are intentionally left unchanged — `sendAccessibilityEvent` is already protected by its own `try/catch (RetryableMountingLayerException)` in `SendAccessibilityEventMountItem.execute`. ## Changelog: [Android] [Fixed] - Handle missing viewState gracefully in `SurfaceMountingManager.updateState` and `updatePadding` to avoid `RetryableMountingLayerException` crashes from the Fabric batch-mount path Reviewed By: javache Differential Revision: D107768754 fbshipit-source-id: 5861bcae5d598b6ffae48c32830d16323474d8bf (cherry picked from commit 0e86a04) * Fix RetryableMountingLayerException crash in updateOverflowInset (react#56762) Summary: Pull Request resolved: react#56762 Fix a crash in `SurfaceMountingManager.updateOverflowInset()` where `getViewState()` throws `RetryableMountingLayerException` when the view state for a tag is not found in the registry. The crash occurs during batch mount item execution when an `updateOverflowInset` operation references a view tag that has been removed from the registry due to normal lifecycle race conditions. The surface is still active (not stopped), but the view has already been deleted. The fix replaces `getViewState(reactTag)` (which throws) with `getNullableViewState(reactTag)` + null check + soft exception logging + early return. This matches the defensive pattern already used by peer methods in the same class: `updateLayout`, `addViewAt`, and `removeViewAt`. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D104400233 fbshipit-source-id: 678df406079da98c0c2180766c936b5f2bb9fcf7 (cherry picked from commit dabb434) --------- Co-authored-by: Shubham Kumar Savita <kumarsavshubham@meta.com> Co-authored-by: Pieter De Baets <pieterdb@meta.com>
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:
Fix a crash in
SurfaceMountingManager.updateOverflowInset()wheregetViewState()throwsRetryableMountingLayerExceptionwhen the view state for a tag is not found in the registry.The crash occurs during batch mount item execution when an
updateOverflowInsetoperation references a view tag that has been removed from the registry due to normal lifecycle race conditions. The surface is still active (not stopped), but the view has already been deleted.The fix replaces
getViewState(reactTag)(which throws) withgetNullableViewState(reactTag)+ null check + soft exception logging + early return. This matches the defensive pattern already used by peer methods in the same class:updateLayout,addViewAt, andremoveViewAt.Logview link: 252c85116a7ab5c4ec93ef3c3373cf9d
Differential Revision: D104400233