Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domains: errors thrown within domains without error handlers cause node to abort at the wrong time when using --abort-on-uncaught-exception #3653

Closed
misterdjules opened this issue Nov 4, 2015 · 1 comment
Labels
domain Issues and PRs related to the domain subsystem.

Comments

@misterdjules
Copy link

When throwing an error from a domain that doesn't have an error handler set, and when using --abort-on-uncaught-exception, instead of aborting at the time the error is thrown, node aborts when trying to emit the error event on the domain because there's no handler for that event:

$ node --version
v4.2.1
$ cat /tmp/domain-throw-no-error-handler.js 
const domain = require('domain');
const d = domain.create();

d.run(function() {
    throw new Error('boom');
});
$ node --abort-on-uncaught-exception /tmp/domain-throw-no-error-handler.js 
Uncaught Error: boom

FROM
Domain.emit (events.js:141:7)
emitError (domain.js:65:24)
Domain.errorHandler [as _errorHandler] (domain.js:104:16)
process._fatalException (node.js:218:33)
[1]    99899 illegal hardware instruction  node --abort-on-uncaught-exception /tmp/domain-throw-no-error-handler.js
$

This can be reproduced on v0.10.40, the tip of the v0.12 branch, v4.2.1 and I suspect v5.x and nodejs/node's master.

@misterdjules misterdjules added domain Issues and PRs related to the domain subsystem. v0.10 labels Nov 4, 2015
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Nov 4, 2015
Make the process abort if an error is thrown within a domain with no
error handler and `--abort-on-uncaught-exception` is used.

If the domain within which the error is thrown has no error handler,
but a domain further down the domains stack has one, the process will
not abort.

Fixes nodejs#3653
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Nov 4, 2015
Make the process abort if an error is thrown within a domain with no
error handler and `--abort-on-uncaught-exception` is used.

If the domain within which the error is thrown has no error handler,
but a domain further down the domains stack has one, the process will
not abort.

Fixes nodejs#3653.
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Nov 17, 2015
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes nodejs#3607 and nodejs#3653.
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Nov 24, 2015
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes nodejs#3607 and nodejs#3653.
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Nov 24, 2015
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes nodejs#3607 and nodejs#3653.
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Dec 11, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Finally, change the behavior of --abort-on-uncaught-exception so that,
if the domain within which the error is thrown has no error handler, but
a domain further up the domains stack has one, the process will not
abort.

Fixes nodejs#3607 and nodejs#3653.
misterdjules pushed a commit that referenced this issue Dec 11, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Finally, change the behavior of --abort-on-uncaught-exception so that,
if the domain within which the error is thrown has no error handler, but
a domain further up the domains stack has one, the process will not
abort.

Fixes #3607 and #3653.

PR: #3654
PR-URL: #3654
Reviewed-By: Chris Dickinson <chris@neversaw.us>
misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Dec 11, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Fixes nodejs#3607 and nodejs#3653.
misterdjules pushed a commit that referenced this issue Dec 15, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Finally, change the behavior of --abort-on-uncaught-exception so that,
if the domain within which the error is thrown has no error handler, but
a domain further up the domains stack has one, the process will not
abort.

Fixes #3607 and #3653.

PR: #3654
PR-URL: #3654
Reviewed-By: Chris Dickinson <chris@neversaw.us>
misterdjules pushed a commit that referenced this issue Dec 16, 2015
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes #3607 and #3653.

PR: #3885
PR-URL: #3885
Reviewed-By: James M Snell <jasnell@gmail.com>
misterdjules pushed a commit that referenced this issue Dec 16, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Fixes #3607 and #3653.

PR: #3884
PR-URL: #3884
Reviewed-By: James M Snell <jasnell@gmail.com>
misterdjules pushed a commit that referenced this issue Dec 17, 2015
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes #3607 and #3653.

PR: #3887
PR-URL: #3887
Reviewed-By: James M Snell <jasnell@gmail.com>
@misterdjules
Copy link
Author

Fixed in v4.x-staging with 25cded4, v0.12-staging with 16417cc, v0.10-staging with 9cae9b2 and master with 425a354.

misterdjules pushed a commit that referenced this issue Dec 17, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Fixes #3607 and #3653.

PR: #3884
PR-URL: #3884
Reviewed-By: James M Snell <jasnell@gmail.com>
misterdjules pushed a commit that referenced this issue Dec 23, 2015
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Fixes #3607 and #3653.

PR: #3884
PR-URL: #3884
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Feb 11, 2016
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes #3607 and #3653.

PR: #3887
PR-URL: #3887
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Feb 11, 2016
Fix node exiting due to an exception being thrown rather than emitting
an 'uncaughtException' event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an 'uncaughtException' event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and --abort-on-uncaught-exception is used.

Fixes #3607 and #3653.

PR: #3885
PR-URL: #3885
Reviewed-By: James M Snell <jasnell@gmail.com>
scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
Fix node exiting due to an exception being thrown rather than emitting
an `'uncaughtException'` event on the process object when:
1. no error handler is set on the domain within which an error is thrown
2. an `'uncaughtException'` event listener is set on the process

Also fix an issue where the process would not abort in the proper
function call if an error is thrown within a domain with no error
handler and `--abort-on-uncaught-exception` is used.

Finally, change the behavior of --abort-on-uncaught-exception so that,
if the domain within which the error is thrown has no error handler, but
a domain further up the domains stack has one, the process will not
abort.

Fixes nodejs#3607 and nodejs#3653.

PR: nodejs#3654
PR-URL: nodejs#3654
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain Issues and PRs related to the domain subsystem.
Projects
None yet
Development

No branches or pull requests

1 participant