src: fix abort-on-uncaught-exception #3038
Closed
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 PR fixes 0af4c9e so that node
aborts at the right time when throwing an error and using
--abort-on-uncaught-exception.
Basically, it wraps most node internal callbacks with:
so that V8 can abort properly in
Isolate::Throw
if--abort-on-uncaught-exception
was passed on the command line, and domaincan handle the error if one is active and not already in the top level
domain's error handler.
It also reverts 921f2de partially:
node::FatalException
does not abort anymore because at that time, it'salready too late.
It adds
process._forceTickDone
, which is really a hack to allowtest-next-tick-error-spin.js
to pass and start the discussion. It's here to basically avoid aninfinite recursion when throwing in a domain from a nextTick callback,
and queuing the same callback on the next tick from the domain's error
handler.
This change is an alternative approach to #3036 for fixing #3035.
Fixes #3035.
/cc @nodejs/post-mortem