-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
deprecate domains #66
Comments
afaik no breaking changes will happen until v1 |
just labeling something as deprecated is not a breaking change |
gotcha, 👍 from me, domains have only meant pain to me personally |
I'm on board, I bet a bunch of TC members would be too, marking as tc-agenda |
+1 |
I never understood why domains were added to core. It seemed wrong at the time, and still seems equally as wrong. For backwards compatibility, will it be possible to put this functionality into an npm module as a custom add-on? Does this already exist? |
+1 domains are confusing and I hear nothing but incompatibilities and edge cases |
+1 sad 🎺
There's a place for unified sync & async error handling for Node, and due to the way that state propagates through core, there at least need to be hooks exposed by core to facilitate this. I'm hopeful that @trevnorris's AsyncWrap can provide the foundation for a better / lower-impact way of building something useful along these lines in the future, and I consider domains a very useful failure that helped point to what AsyncWrap / AsyncListener should do. |
It would have to go through the TC but I don't think there is much opposition to deprecating domains. Who volunteers to follow up with a pull request? |
@bnoordhuis A deprecation warning if you call |
@tellnes I'll leave that to your own judgment. Doing it at require() time would get the message out most effectively but it might end up being extremely annoying. If you do do it at require() time, you should also update lib/repl.js and make it load the domain module lazily. |
|
Is there a suitable replacement that could be used? Repl is a valid use-case for example. |
+1 what @Marak said and +1 @Fishrock123 said, so +2 |
What is TC? Only TechCrunch is going in my mind. |
+1 domains have only brought me pain and suffering in my code and were not good enough in practice. I'd love to see them removed in v1 and deprecated today. |
@SosZ please search and read the whole thread before, I patched promises to use domains myself, in a much simpler way Your code is a little bit of a horror show. What about this instead? const then = Promise.prototype.then;
Promise.prototype.then = function (fn1, fn2) {
if (process.domain) {
fn1 = fn1 && process.domain.bind(fn1);
fn2 = fn2 && process.domain.bind(fn2);
}
return then.call(this, fn1, fn2);
}; Note that you do not need to patch the Promise constructor, because the executors run synchronously, but you can patch |
I just want to add my 2 cents to the long run discussion. I have a job. I want to keep my job. I really prefer to not have my server(s) crash, even if we use Using the following allows us to avoid many crashes: let domain = require('domain');
app.use(function(req, res, next){
let d = domain.create(); // create a new domain for this request
res.once('finish', function(){
d.exit();
d.removeAllListeners();
});
d.once('error', function(e){
// log the issue right here
if(!res.headersSent){
res.json({
error: e.stack || e
});
}
});
d.run(next); // we invoke the next middleware
}); we use domains in production. Hopefully no memory leaks though 😂 |
@ORESoftware I've moderated your previous comment. I found it to be inappropriate for this issue tracker. We intend on keeping this issue tracker professional and would appreciate if everyone who posts here does the same. |
Domains are still a hack, letting the process crash is often the better option especially with forever/supervisor. |
@evanlucas censorship always appreciated, but I guess you're right, best to keep politics off of Github lol...@nickmmcurdy - you'd have to back up that statement - domains will fail in their intention if an error is raised for the wrong path of execution, and if it's easy to misuse them than that's also bad. But I don't think they are a hack perse, just perhaps imperfectly implemented. |
@ORESoftware We have a Code of Conduct that asks you to be respectful of other people’s viewpoints and refrain from using language that “could reasonably be considered inappropriate in a professional setting”. If you don’t feel comfortable with that, it might be easier to take a step back; Node’s project leadership is standing behind the choice to apply that CoC to our spaces. |
Imma read the CoC right now to see if my microaggression actually violated it. |
Yep, looks like I violated point 1
whoops, my bad fam |
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@d2283ba
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@8130669
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@d2283ba
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@8130669
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@d2283ba PR-URL: #38275 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
Original commit message: [macro-assembler] Avoid using the isolate in CallRecordWriteStub CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=[email protected] (cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Thibaud Michaud <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#71785} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535 Commit-Queue: Victor-Gabriel Savu <[email protected]> Reviewed-by: Jana Grill <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{#66} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@8130669 PR-URL: #38275 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
what's the status on domains? can we deprecate it before v1?
The text was updated successfully, but these errors were encountered: