react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Android][Fabric] SurfaceMountingManager.updatePadding still hard-crashes with RetryableMountingLayerException: Unable to find viewState in 0.86 (addViewAt/updateLayout were made soft)

Open sangupandi opened this issue 1 month ago • 5 comments

Description

Description: 0.86 stopped addViewAt, updateLayout, updateProps, deleteView and removeViewAt from crashing on a missing view, but updatePadding (line 876) still throws. It quotes the 0.86 source and lists the other operations that still throw (updateOverflowInset, updateState, setJSResponder, sendAccessibilityEvent). It also suggests a fix in the same style as updateLayout, and links #55177, #58526 and #58527. Steps to reproduce: honest that it's a production race we can't reproduce on demand, with the device pattern: 100% Android 12 on 32-bit low-end phones, mostly vivo, during launch or quick tab switches. It also notes the crash ran about 3× higher through addViewAt on 0.82. Versions: RN 0.86.0, React 19.2.8, New Architecture and Hermes on, and the versions of Reanimated, Screens, Gesture Handler, pager-view, bottom-sheet and React Navigation. Stack trace: the full updatePadding trace. All sampled crashes share it; only the tag differs. Reproducer: none available; offers to test a patched build.

Steps to reproduce

Honest that it's a production race we can't reproduce on demand, with the device pattern: 100% Android 12 on 32-bit low-end phones, mostly vivo, during launch or quick tab switches. It also notes the crash ran about 3× higher through addViewAt on 0.82.

React Native Version

0.86.0

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

N/A

Stacktrace or Logs

Fatal Exception: java.lang.IllegalStateException: Unable to remove a view from a view that is not a ViewGroup. ParentTag: 12156 - Tag: 12154 - Index: 0
       at com.facebook.react.fabric.mounting.SurfaceMountingManager.removeViewAt(SurfaceMountingManager.kt:444)
       at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.kt:125)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.kt:379)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems$lambda$7$lambda$6(MountItemDispatcher.kt:269)
       at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.kt:46)
       at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.kt:35)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.kt:250)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.kt:94)
       at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1624)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:42)
       at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(ReactChoreographer.kt:58)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1184)
       at android.view.Choreographer.doCallbacks(Choreographer.java:986)
       at android.view.Choreographer.doFrame(Choreographer.java:907)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1171)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:334)
       at android.app.ActivityThread.main(ActivityThread.java:8333)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1065)

MANDATORY Reproducer

n/A

Screenshots and Videos

No response

sangupandi avatar Oct 08 '26 13:10 sangupandi

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


You can read more about about it on our website: How to report a bug.

react-native-bot avatar Oct 08 '26 13:10 react-native-bot

@sangupandi Check #58953 by making the SurfaceMountingManager methods use soft exception handling instead of hard-crashing.

Changes made:

0001-Fix-Make-SurfaceMountingManager-methods-soft-instead.patch

  • updatePadding
  • updateOverflowInset
  • updateState
  • receiveCommand (both overloads)
  • updateProps
  • addViewAt
  • removeViewAt
  • onViewStateDeleted

These methods now use the elvis operator pattern (?: return) instead of checkNotNull/RetryableMountingLayerException, matching the behavior of updateLayout which was already fixed in 0.86.

Test cases added: 5 test cases to verify methods don't crash on missing tags.

Patch file attached: 0001-Fix-Make-SurfaceMountingManager-methods-soft-instead.patch

shameemkpofficial-git avatar Oct 13 '26 11:10 shameemkpofficial-git

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

react-native-bot avatar Nov 07 '26 05:11 react-native-bot

This issue was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar Nov 14 '26 05:11 react-native-bot

This issue was closed because the author hasn't provided the requested feedback after 7 days.

react-native-bot avatar Nov 14 '26 05:11 react-native-bot