Skip to content

refactor(host): drop the shadowing napi_fatal_error - #492

Draft
kraenhansen wants to merge 4 commits into
nextfrom
feat/hermes-fatal-handler
Draft

kraenhansen wants to merge 4 commits into
nextfrom
feat/hermes-fatal-handler

Conversation

@kraenhansen

@kraenhansen kraenhansen commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Warning

Don't merge this before react/react-native#59728 is fixed (proposed fix: react/react-native#59729). Until then, removing this override leaves a napi_fatal_error on Android as a bare SIGSEGV, with no reason in logcat or the tombstone.

Related to #491.

Deletes the host's shadowing napi_fatal_error, so it resolves to Hermes' own implementation like the rest of Node-API since #434. RuntimeNodeApi.{hpp,cpp} contained nothing else, so both are gone.

An earlier version of this PR installed a Hermes fatal handler instead. That was dropped because Hermes already handles fatal errors: it writes the message to stderr and takes the process down. The handler slot is also process-wide with no getter, so a library can't detect or chain an existing handler, and could replace a better one from the app or React Native.

Behaviour change. Fatal Node-API errors still abort the process, but on Android the message goes to stderr instead of logcat, and with HERMES_IS_MOBILE_BUILD the process dies from Hermes' deliberate null write rather than abort(). React Native only installs a logging handler on the legacy path, so logcat visibility on the new architecture is better addressed there, and that's what this PR waits for.

Test plan

  • Host C++ tests pass on macOS (ctest)
  • Regenerated WeakNodeApiInjector.cpp compiles and references the global napi_fatal_error
  • pnpm run build, plus ESLint and Prettier on the changed files
  • Android and iOS builds in CI
  • A fatal error from an addon aborts on a device or emulator

🤖 Generated with Claude Code

@kraenhansen kraenhansen added Host 🏡 Our `react-native-node-api-modules` package Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) labels Oct 31, 2026
kraenhansen and others added 2 commits October 31, 2026 21:22
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Replaces the fatal handler with a plain deletion: Hermes already handles
fatal errors, and the handler slot is process-wide, so a library can't
safely own it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kraenhansen kraenhansen changed the title feat(host): log Hermes fatal errors through a fatal handler refactor(host): drop the shadowing napi_fatal_error Oct 31, 2026
@kraenhansen kraenhansen self-assigned this Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Host 🏡 Our `react-native-node-api-modules` package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant