You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
I got this when I was trying to verify whether nodereport after reporting an uncaught exception, would let the exception continue to propagate and cause node to exit (as it should).
Yes, nodereport sets --abort_on_uncaught_exception, and uses isolate->SetAbortOnUncaughtExceptionCallback() to intercept the exception. So the behaviour you are seeing should be the same as when running node with --abort_on_uncaught_exception. On Linux the v8::base::OS::Abort()code intentionally aborts and triggers a core dump using an illegal instruction. The nodereport setCoreDump(yes/no) API should let you switch to node behaviour without --abort_on_uncaught_exception. Maybe that should be the default.
I think normal node behaviour should be the default, yes. If people want abort on uncaught exception, they can set that flag on the command line.
But... it sounds like the mechanism you are using won't allow that. Have you considered using process.once('uncaughtException', .. (in c++) to catch uncaught exceptions? That would allow you to re-raise them, I think, and for whatever the "normal" thing is to happen (normal means uncaught exceptions usually print stack traces and exit with 1, unless --abort_on_uncaught_exception is set in which case it aborts, or unless some user has unwisely added an event listener for uncaughtException, in which case they are responsible for handling it).
I'm pretty surprised node aborts with an illegal instruction and not abort(3).
on node 4 and 6, with node-report enabled, the uncaught exception prints a stack trace but node continues rather than exiting with rc=1
the demos need a refresh to reflect the node-report defaults change, plus improvement, e.g buttons to trigger the required events rather than browser refresh
The logic was added to fix behaviour when domains are used. It prevents the --abort-on-uncaught-exception option from triggering an abort when domains are used to catch errors. In practice, domains are deprecated, and the call to TopDomainHasErrorHandler(env) has a simple check, which means that the logic is a no-op now:
if (!env->using_domains())
return false;
So I've simply omitted that code in the node-report callback
Activity
sam-github commentedon Oct 27, 2016
Its fairly reproduceable. I ran with gdb, too:
rnchamberlain commentedon Oct 28, 2016
Yes, nodereport sets --abort_on_uncaught_exception, and uses
isolate->SetAbortOnUncaughtExceptionCallback()to intercept the exception. So the behaviour you are seeing should be the same as when running node with --abort_on_uncaught_exception. On Linux thev8::base::OS::Abort()code intentionally aborts and triggers a core dump using an illegal instruction. The nodereport setCoreDump(yes/no) API should let you switch to node behaviour without --abort_on_uncaught_exception. Maybe that should be the default.sam-github commentedon Oct 28, 2016
I think normal node behaviour should be the default, yes. If people want abort on uncaught exception, they can set that flag on the command line.
But... it sounds like the mechanism you are using won't allow that. Have you considered using
process.once('uncaughtException', ..(in c++) to catch uncaught exceptions? That would allow you to re-raise them, I think, and for whatever the "normal" thing is to happen (normal means uncaught exceptions usually print stack traces and exit with1, unless--abort_on_uncaught_exceptionis set in which case it aborts, or unless some user has unwisely added an event listener foruncaughtException, in which case they are responsible for handling it).I'm pretty surprised node aborts with an illegal instruction and not
abort(3).rnchamberlain commentedon Feb 24, 2017
This still needs more work:
on node 4 and 6, with node-report enabled, the uncaught exception prints a stack trace but node continues rather than exiting with rc=1
the demos need a refresh to reflect the node-report defaults change, plus improvement, e.g buttons to trigger the required events rather than browser refresh
richardlau commentedon Mar 10, 2017
We replace Node.js'
ShouldAbortOnUncaughtExceptioncallback with our own. Should we duplicate the logic?rnchamberlain commentedon Mar 15, 2017
There is a complicated story behind ShouldAbortOnUncaughtException() in node.cc, see:
nodejs/node#3036
nodejs/node#3654
The logic was added to fix behaviour when domains are used. It prevents the --abort-on-uncaught-exception option from triggering an abort when domains are used to catch errors. In practice, domains are deprecated, and the call to TopDomainHasErrorHandler(env) has a simple check, which means that the logic is a no-op now:
So I've simply omitted that code in the node-report callback
rnchamberlain commentedon Mar 23, 2017
@sam-github latest node-report v2.1.2 has the fix to the exception handler, and the improved demos, hopefully we can close this now