Repository navigation
refactor(host): drop the shadowing napi_fatal_error - #492
Draft
kraenhansen wants to merge 4 commits into
Draft
kraenhansen wants to merge 4 commits into
kraenhansen wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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) <noreply@anthropic.com>
This was referenced Oct 31, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
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_erroron Android as a bareSIGSEGV, 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_BUILDthe process dies from Hermes' deliberate null write rather thanabort(). 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
ctest)WeakNodeApiInjector.cppcompiles and references the globalnapi_fatal_errorpnpm run build, plus ESLint and Prettier on the changed files🤖 Generated with Claude Code