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

Allow registering multiple uncaught exception capture callbacks #23348

Closed
misterdjules opened this issue Oct 9, 2018 · 5 comments
Closed

Allow registering multiple uncaught exception capture callbacks #23348

misterdjules opened this issue Oct 9, 2018 · 5 comments
Labels
domain Issues and PRs related to the domain subsystem. feature request Issues that request new features to be added to Node.js. stale

Comments

@misterdjules
Copy link

Is your feature request related to a problem? Please describe.

While experimenting with building a user-land alternative to the core domain module, I realized that the fact that one can only set one uncaught exception callback makes it more difficult than it could be.

Basically, the problem is that it is not possible to have two different implementations of a "domain-like" module loaded at the same time in a given process. For instance, it is currently not possible to load the user-land domaine module along with the core domain module.

This makes it difficult for applications to start adopting user-land alternatives to domain: in the current state, they (and all their dependencies) either need to adopt one single user-land alternative, or stick with the core domain module.

A good example is when I ported restify to use this new domaine module instead of the core domain module. I had to port node-tap (which is used to run restify's tests) to use that new domaine module as well.

Another example is the fact that one cannot use a user-land domain-like module from within the core repl because it requires domain.

This is something that I started discussing with @addaleax but that I thought would benefit from being presented to a broader set of people to gather initial feedback, comments and suggestions.

Describe the solution you'd like

The fundamental change would be to allow multiple uncaught exception callbacks to be registered.
I haven't thought too much about the design or the implementation details of a specific solution. I'd first like to gather feedback on whether people would be open to allowing multiple callbacks to be registered.

Describe alternatives you've considered

The only alternative to having this feature available that I can see for now is to require applications to migrate their code and all their dependencies to any user-land domain module that they choose to use.

Looking forward to reading your thoughts!

/cc @addaleax @vdeturckheim @nodejs/domains

@misterdjules misterdjules added the domain Issues and PRs related to the domain subsystem. label Oct 9, 2018
@Trott Trott added the feature request Issues that request new features to be added to Node.js. label Oct 9, 2018
@mhdawson
Copy link
Member

mhdawson commented Oct 9, 2018

Makes a sense to me as long as no major perf overhead.

@vdeturckheim
Copy link
Member

I'd be 👍 for such update.

Also, we could update the domain's callback to accept to call other ones after itself but this might get pretty confusing.

@mhdawson I think perf impact would only happen when there is an uncaught exception, which should be rare in theory

@misterdjules
Copy link
Author

Submitted a proof-of-concept PR at #24279. @vdeturckheim @mhdawson I would be grateful if you had the time to give me some feedback on that :)

misterdjules pushed a commit to misterdjules/node-1 that referenced this issue Feb 27, 2019
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Trott pushed a commit to Trott/io.js that referenced this issue Aug 7, 2020
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Trott added a commit to Trott/io.js that referenced this issue Mar 27, 2021
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Co-authored-by: Rich Trott <rtrott@gmail.com>
Trott added a commit to Trott/io.js that referenced this issue Mar 27, 2021
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Co-authored-by: Rich Trott <rtrott@gmail.com>
Trott added a commit to Trott/io.js that referenced this issue Mar 27, 2021
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Co-authored-by: Rich Trott <rtrott@gmail.com>
Trott added a commit to Trott/io.js that referenced this issue Mar 28, 2021
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Co-authored-by: Rich Trott <rtrott@gmail.com>
Trott added a commit to Trott/io.js that referenced this issue Mar 30, 2021
Currently, only one domain-lke implementation (the core domain one) can
be used to handle uncaught exceptions or unhandled error events.

This PR aims at making it possible for different domain-like
user-land implementations to be used concurrently (including with the
core domain impl) so that the state of the core domain module (doc
deprecated) does not prevent users of domains from having a
well-maintained domain-like facility.

Ref: nodejs#23348
Co-authored-by: Rich Trott <rtrott@gmail.com>
@github-actions
Copy link
Contributor

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2022

There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.

For more information on how the project manages feature requests, please consult the feature request management document.

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. feature request Issues that request new features to be added to Node.js. stale
Projects
None yet
Development

No branches or pull requests

4 participants