src: add SetAbortHandler - #64684
Closed
maxhfisher wants to merge 8 commits into
Closed
Conversation
Signed-off-by: Max H Fisher <mfisher187@bloomberg.net>
Collaborator
|
Review requested:
|
legendecas
reviewed
Jul 23, 2026
legendecas
reviewed
Jul 23, 2026
Codecov Reportβ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64684 +/- ##
==========================================
+ Coverage 90.11% 90.28% +0.17%
==========================================
Files 741 759 +18
Lines 242196 247639 +5443
Branches 45606 46691 +1085
==========================================
+ Hits 218246 223581 +5335
- Misses 15438 15520 +82
- Partials 8512 8538 +26
π New features to boost your workflow:
|
Signed-off-by: Max H Fisher <mfisher187@bloomberg.net>
legendecas
reviewed
Jul 24, 2026
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
legendecas
approved these changes
Jul 28, 2026
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
maxhfisher
marked this pull request as draft
August 5, 2026 15:28
maxhfisher
marked this pull request as ready for review
August 5, 2026 19:44
legendecas
reviewed
Aug 6, 2026
legendecas
approved these changes
Aug 7, 2026
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Collaborator
Commit Queue failed- Loading data for nodejs/node/pull/64684 β Done loading data for nodejs/node/pull/64684 ----------------------------------- PR info ------------------------------------ Title src: add SetAbortHandler (#64684) β Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch maxhfisher:aborthandler -> nodejs:main Labels c++, author ready, needs-ci, review wanted, commit-queue, commit-queue-squash Commits 8 - src: add SetAbortHandler - fix: fix lint - fix: respond to PR comments - fix: Update default abort message - fix: Split handler arguments into location and message - Merge branch 'nodejs:main' into aborthandler - fix: Be more clear about null arguments in abort handler - fix: Prose Committers 2 - Max H Fisher <mfisher187@bloomberg.net> - GitHub <noreply@github.com> PR-URL: https://github.com/nodejs/node/pull/64684 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/64684 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> -------------------------------------------------------------------------------- βΉ This PR was created on Wed, 22 Jul 2026 20:52:39 GMT β Approvals: 1 β - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/64684#pullrequestreview-4883277125 β Last GitHub CI successful βΉ Last Full PR CI on 2026-08-09T07:55:41Z: https://ci.nodejs.org/job/node-test-pull-request/75684/ - Querying data for job/node-test-pull-request/75684/ β Build data downloaded β Last Jenkins CI successful -------------------------------------------------------------------------------- β No git cherry-pick in progress β No git am in progress β No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD β origin/main is now up-to-date - Downloading patch for 64684 From https://github.com/nodejs/node * branch refs/pull/64684/merge -> FETCH_HEAD β Fetched commits as 2749388e44ac..455cbed91694 -------------------------------------------------------------------------------- Auto-merging src/util.h [main 8c9e8f5a6d] src: add SetAbortHandler Author: Max H Fisher <mfisher187@bloomberg.net> Date: Wed Jul 22 16:07:43 2026 -0400 8 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 test/abort/test-addon-abort-handler.js create mode 100644 test/addons/abort-handler/binding.cc create mode 100644 test/addons/abort-handler/binding.gyp create mode 100644 test/addons/abort-handler/test.js [main f64686a503] fix: fix lint Author: Max H Fisher <mfisher187@bloomberg.net> Date: Wed Jul 22 17:48:50 2026 -0400 1 file changed, 2 insertions(+), 2 deletions(-) Auto-merging src/util.h [main ca1cadebfb] fix: respond to PR comments Author: Max H Fisher <mfisher187@bloomberg.net> Date: Thu Jul 23 17:16:39 2026 -0400 7 files changed, 55 insertions(+), 45 deletions(-) delete mode 100644 test/abort/test-addon-abort-handler.js Auto-merging src/util.h [main deac2a26a1] fix: Update default abort message Author: Max Fisher <66274614+maxhfisher@users.noreply.github.com> Date: Fri Jul 24 16:58:44 2026 -0400 1 file changed, 1 insertion(+), 1 deletion(-) Auto-merging src/util.h error: commit f579940a11b9a8d0afb94a9b6d7353bc2b348ebe is a merge but no -m option was given. fatal: cherry-pick failed [main c0979cfc85] fix: Split handler arguments into location and message Author: Max H Fisher <mfisher187@bloomberg.net> Date: Wed Aug 5 15:26:31 2026 -0400 5 files changed, 29 insertions(+), 22 deletions(-) β Failed to apply patcheshttps://github.com/nodejs/node/actions/runs/31535700850 |
legendecas
pushed a commit
that referenced
this pull request
Aug 11, 2026
Signed-off-by: Max H Fisher <mfisher187@bloomberg.net> PR-URL: #64684 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Member
|
Landed in 559afb1 |
aduh95
pushed a commit
that referenced
this pull request
Aug 13, 2026
Signed-off-by: Max H Fisher <mfisher187@bloomberg.net> PR-URL: #64684 Reviewed-By: Chengzhong Wu <legendecas@gmail.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.
This adds
SetAbortHandler, which allows embedders to specify custom behavior in situations whereABORT()is called. The current behavior ofABORT()is to stream both the native and JS backtraces tostderrand exit with platform specific behavior. Some embedders may want to change this behavior, such as changing where the backtrace is provided. Embedders can also use the handler to exit with their own behavior, but node will still guarantee an exit if the provided abort handler returns.A
DefaultAbortHandleris used to ensure existing behavior does not change unless an abort handler is explicitly provided. The only difference with this design is an additional stack frame in the backtrace for the abort handler, but this behavior was never guaranteed.A new
ABORT_WITH_DETAILSmacro is also added for cases where a location and message can be passed describing the abort. This new macro replaces existing calls toABORTin various error handlers innode_errors.ccwhere a message is already available. This message is then propagated to the abort handler, but no changes are made to the default abort handler. That behavior does not change here.