Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of nullThis error is located at: in b...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null #6128

Closed
sentry-io bot opened this issue Aug 29, 2023 · 7 comments · Fixed by WordPress/gutenberg#56903

Comments

@sentry-io
Copy link

sentry-io bot commented Aug 29, 2023

Sentry Issue: JETPACK-IOS-1448

Stack Traces

Symbolicated stack trace
This error is located at:
    in b
    in RCTView
    in Unknown
    in o
    in RCTView
    in Unknown..., stack:
/workdir/gutenberg/packages/block-editor/src/components/block-styles/index.native.js:28:selector
/workdir/gutenberg/packages/data/src/components/use-select/index.js:134:registry.__unstableMarkListeningStores$argument_0
/workdir/gutenberg/packages/data/src/registry.js:123:__unstableMarkListeningStores
/workdir/gutenberg/packages/data/src/registry.js:204:<anonymous>
/workdir/gutenberg/packages/data/src/components/use-select/index.js:133:updateValue
/workdir/gutenberg/packages/data/src/components/use-select/index.js:180:<anonymous>
/workdir/gutenberg/packages/data/src/components/use-select/index.js:198:useMappingSelect
/workdir/gutenberg/packages/data/src/components/use-select/index.js:287:useSelect
/workdir/gutenberg/packages/block-editor/src/components/block-styles/index.native.js:33:BlockStyles
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3525:renderWithHooks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:4491:updateFunctionComponent
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7850:beginWork$1
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7304:performUnitOfWork
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7297:workLoopSync
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7279:renderRootSync
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6975:performSyncWorkOnRoot
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2145:flushSyncCallbacks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6650:scheduleUpdateOnFiber
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3767:forceStoreRerender
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3752:subscribe$argument_0
/workdir/gutenberg/packages/data/src/components/use-select/index.js:69:onStoreChange
/workdir/gutenberg/packages/data/src/components/use-select/index.js:76:onChange
/workdir/gutenberg/packages/data/src/registry.js:247:currentSubscribe$argument_0
/workdir/gutenberg/packages/data/src/redux-store/index.js:327:store.subscribe$argument_0
/workdir/gutenberg/node_modules/redux/lib/redux.js:304:dispatch
/workdir/gutenberg/packages/data/src/redux-store/thunk-middleware.js:7:<anonymous>
/workdir/gutenberg/packages/redux-routine/src/index.js:24:<anonymous>
/workdir/gutenberg/packages/data/src/promise-middleware.js:20:<anonymous>
/workdir/gutenberg/packages/data/src/resolvers-cache-middleware.js:51:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/index.js:222:Proxy$argument_1.apply
/workdir/gutenberg/packages/core-data/src/actions.js:394:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/thunk-middleware.js:4:<anonymous>
/workdir/gutenberg/packages/redux-routine/src/index.js:24:<anonymous>
/workdir/gutenberg/packages/data/src/promise-middleware.js:20:<anonymous>
/workdir/gutenberg/packages/data/src/resolvers-cache-middleware.js:51:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/index.js:202:<anonymous>
/workdir/gutenberg/packages/editor/src/store/actions.js:139:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/thunk-middleware.js:4:<anonymous>
/workdir/gutenberg/packages/redux-routine/src/index.js:24:<anonymous>
/workdir/gutenberg/packages/data/src/promise-middleware.js:20:<anonymous>
/workdir/gutenberg/packages/data/src/resolvers-cache-middleware.js:51:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/index.js:202:<anonymous>
/workdir/gutenberg/packages/editor/src/store/actions.js:534:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/thunk-middleware.js:4:<anonymous>
/workdir/gutenberg/packages/redux-routine/src/index.js:24:<anonymous>
/workdir/gutenberg/packages/data/src/promise-middleware.js:20:<anonymous>
/workdir/gutenberg/packages/data/src/resolvers-cache-middleware.js:51:<anonymous>
/workdir/gutenberg/packages/data/src/redux-store/index.js:202:<anonymous>
/workdir/gutenberg/packages/editor/src/components/provider/index.native.js:405:resetEditorBlocksWithoutUndoLevel
/workdir/gutenberg/packages/data/src/components/use-dispatch/use-dispatch-with-map.js:53:<anonymous>
/workdir/gutenberg/packages/editor/src/components/provider/index.native.js:310:NativeEditorProvider#updateHtmlAction
/workdir/gutenberg/packages/editor/src/components/provider/index.native.js:126:subscribeUpdateHtml$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:105:emit
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:427:__callFunction
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:__guard$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:__guard
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:callFunctionReturnFlushedQueue
Raw stack trace
RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of null

This error is located at:
    in b
    in RCTView
    in Unknown
    in o
    in RCTView
    in Unknown
    in S
    in S
    in v
    in InspectorControlsSlot
  ...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null

This error is located at:
    in b
    in RCTView
    in Unknown
    in o
    in RCTView
    in Unknown..., stack:
anonymous@1:3293966
anonymous@1:1652696
__unstableMarkListeningStores@1:1604516
anonymous@1:1604719
w@1:1652487
anonymous@1:1652395
b@1:1653288
anonymous@1:1653430
b@1:3293627
Or@1:381047
Ol@1:387288
Ma@1:421296
zi@1:408301
Ri@1:408203
Pi@1:408087
ki@1:405587
xt@1:370707
hi@1:403064
nl@1:382951
anonymous@1:382845
t@1:1652889
c@1:1652914
anonymous@1:1603448
anonymous@1:1610543
b@1:1613624
anonymous@1:1645460
anonymous@1:1616664
anonymous@1:1644101
anonymous@1:1644434
apply@1:1610140
anonymous@1:3255398
anonymous@1:1645476
anonymous@1:1616664
anonymous@1:1644101
anonymous@1:1644434
anonymous@1:1609575
anonymous@1:3549491
anonymous@1:1645476
anonymous@1:1616664
anonymous@1:1644101
anonymous@1:1644434
anonymous@1:1609575
anonymous@1:3551942
anonymous@1:1645476
anonymous@1:1616664
anonymous@1:1644101
anonymous@1:1644434
anonymous@1:1609575
resetEditorBlocksWithoutUndoLevel@1:3564359
anonymous@1:1658033
value@1:3563395
anonymous@1:3562035
value@1:160442
value@1:164627
anonymous@1:163127
value@1:164073
value@1:163085

  ?, in RCTFatal
  ?, in -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:]
  ?, in -[RCTExceptionsManager reportException:]
  ?, in -[RCTModuleMethod invokeWithBridge:module:arguments:]
  ?, in facebook::react::invokeInner
...
(13 additional frame(s) were not displayed)

Steps to Reproduce

  1. Open a post with a few text blocks and a lot of images (e.g. 3 galleries of 90+ images each).
  2. Make a text modification to mark the post as "dirty."
  3. Focus an image block and attempt to open the block settings.
  4. Before the block settings opens, tap the "Update" button to save the post's content.

Once persisting the post update finishes, the app attempts to open the block settings and crashes.

@fluiddot
Copy link
Contributor

⚠️ I noticed that the above Sentry issue groups the different JavaScript exceptions. This is likely related to using Hermes and the React Native upgrade. Hence, starting in version 23.0, it's likely that all JavaScript exceptions will be grouped there.

I'll review the exceptions we have in version 23.0 and create separate issues to track them.

@staskus
Copy link

staskus commented Aug 29, 2023

Thanks for taking a look at it, @fluiddot 🙇 . I had a question if those exceptions are related or not.

You can find a list here, under merged issues. I'll assign you to the cases for the transparency. This is the current list for WordPress and Jetpack but these are likely the same issues duplicated for each app

image image

@fluiddot
Copy link
Contributor

You can find a list here, under merged issues. I'll assign you to the cases for the transparency. This is the current list for WordPress and Jetpack but these are likely the same issues duplicated for each app

Great, thanks! Regarding the merged issues, since they are caused by different errors I'll go ahead and unmerge them In Sentry.

@fluiddot fluiddot transferred this issue from wordpress-mobile/WordPress-iOS Aug 29, 2023
@fluiddot fluiddot changed the title RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of null This error is located at: in b...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null [iOS] RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of nullThis error is located at: in b...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null Aug 29, 2023
@fluiddot
Copy link
Contributor

Heads up that I'm unassigning myself from the issue as I'm tackling other crashes. Once I or any other team member has availability, we'll assign ourselves again.

@fluiddot fluiddot removed their assignment Aug 30, 2023
Copy link
Author

sentry-io bot commented Nov 30, 2023

Sentry issue: JETPACK-IOS-15W8

@dcalhoun
Copy link
Member

dcalhoun commented Dec 8, 2023

As outlined in detail in #6359 (comment) and #6359 (comment), I was able to reproduce this crash when interacting with an editor with degraded performance due to a large number of images in the post.

From my testing, the symbolicated stack trace (captured in the issue description) points to the fact that getBlock returns null (which is possible) and we attempt to access a name attribute on the null block.

While it is possible for getBlock to return null values, my thought that it is surprising in this instance since we are hypothetically taking action on an existing block. My thought is that a race condition exists that is exasperated by a hanging editor with low performance. I.e., at some point the store state is empty, incorrect, or unavailable when the getBlock logic is executed.

We could (and likely should) fix this specific crash by guarding against the null value, but the underlying performance issue and race condition will likely cause additional crashes to arise elsewhere. If the race condition is not solvable definitively, we likely need to null check everywhere. Ideally we could enforce null checking (e.g., via static type checking) to avoid regressions.

@dcalhoun dcalhoun changed the title [iOS] RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of nullThis error is located at: in b...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'name' of nullThis error is located at: in b...: Unhandled JS Exception: TypeError: Cannot read property 'name' of null Dec 8, 2023
@dcalhoun dcalhoun self-assigned this Dec 8, 2023
Copy link
Author

sentry-io bot commented Feb 2, 2024

Sentry issue: JETPACK-ANDROID-HV9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants