-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 #75
Conversation
@@ -290,4 +290,5 @@ Domain.prototype.dispose = util.deprecate(function() { | |||
// mark this domain as 'no longer relevant' | |||
// so that it can't be entered or activated. | |||
this._disposed = true; | |||
}); | |||
}, 'domain.dispose() is deprecated. Please recover from failed IO actions ' + | |||
'explicitly via error event handlers set on the domain.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the advice we want to give?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is copied directly from the documentation in doc/api/domain.markdown
(d86814a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Can you amend the commit log to mention that?
EDIT: On a general note, commit logs should explain what changed and why. One-liners are almost never sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some more info to the commit message.
53ed3ec
to
6805268
Compare
The PR mostly LGTM. The commit logs could perhaps still use some love and it would be good to have closure on the failing test but the basic approach seems sound. I'd like to get one more LGTM. @chrisdickinson or @cjihrig Can one of you take a look? |
return true; | ||
} | ||
} | ||
var asyncListener = tracing.createAsyncListener({ error: errorListener }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that tracing.createAsyncListener()
was going away as part of @trevnorris's work on removing the JS-side AsyncListener API. Am I incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, what is the correct api to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The safest thing would be to stick with domains for now, perhaps with a workaround to allow the REPL to use them without printing a deprecation warning. If you felt ambitious, you might build a lightweight layer atop the C++ AsyncWrap implementation (which will still be exposed via process.binding
). But since domains are just getting deprecated, not removed, it's fine to still be using them in core, in my opinion. @trevnorris, do you have thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about some code for the repl in process._fatalException
in src/node.js
?
Alternatively we can just listen to uncaughtException
. This functionality is about not breaking the repl when there is an uncaughtException and instead just displaying the error to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would lean more towards using process._fatalException
than uncaughtException
, because the latter is built on the former anyway. I'm sure a decent top-level error handler could be built atop _fatalException
alone, but, out of curiosity: why not just leave the domains code in the REPL for now? It works fine in the repl, the domains code will still be there for a while, and as far as I know, many people near to core are still committed to the idea of coming up with an improved async error-handling solution for Node in the not too distant future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the domain code is still in the REPL. I've just changed it to only use domains if the user provides one (which is possible, but undocumented). It does not fallback to calling domain.create()
which trigger the deprecation warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, how it is implemented now makes the REPL catch all uncaught exceptions. Maybe that should be possible to change with an option and be disabled by default if you are using the REPL as a library.
I think this is getting out of scope for this pull request. Maybe it should be addressed in its own? But it needs to be addressed before the deprecation can be merged.
About the test I've changed. After some digging I've found out it actually was broken by 7afdba6. I've changed the test to look like the following code. This fails on the current v0.12 branch which proves the error was swallowed. testMe.complete('toSt', function(error, data) {
try {
assert.deepEqual(data, [['toString'], 'toSt']);
} catch (err) {
console.log('error');
process.exit(1);
return;
}
console.log('ok');
}); |
if (!exports.repl) { | ||
exports.repl = repl; | ||
tracing.addAsyncListener(asyncListener); | ||
repl.on('exit', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just me being paranoid, but could we use .once
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but shouldn't that be guaranteed by the api that the exit code is only fired once? If not, there probably a lot of broken code out there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason to prefer .once() over .on() is that the former lets the function's closure object get garbage collected before the EventEmitter object is collected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll change it.
Ok. I've removed the REPL changes and just fixed it so it doesn't shows a deprecation warning. I think the REPL issues should be addressed on its own. I'll wait until @trevnorris or some one else comments on the usage of |
Hello! I am pleased to see your valuable contribution to this project. Would you Questions:
Please provide the answers in an ordered list like this:
Note that I am just a bot with a limited human-reply parsing abilities, In case of success I will say: In case of validation problem I will say: Truly yours, Responsibilities
|
|
...summoning the core team devs! |
Ping @chrisdickinson, @cjihrig and @trevnorris. I'll bring this up in the TC meeting tomorrow and I'm assigning it to the v1.0.0 milestone so that we will have to make a decision before the first release. |
|
||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function (chunk) { | ||
stderr += chunk; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just fail here and remove the child.on('exit', ...);
This LGTM besides one nit. I'm in favor of deprecating domains, but has an replacement been discussed? For example, I've heard of (but not looked into whatsoever) StrongLoop's zones. Or, is the idea going forward not to have a replacement? |
Deprecated in d86814a without a deprecation message. Deprecation message copied from documentation.
Original commit message: [LTS-M86][compiler][x64] Fix bug in InstructionSelector::ChangeInt32ToInt64 (cherry picked from commit 02f84c745fc0cae5927a66dc4a3e81334e8f60a6) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1196683 Change-Id: Ib4ea738b47b64edc81450583be4c80a41698c3d1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2820971 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#73903} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2821959 Commit-Queue: Jana Grill <janagrill@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#75} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@3066b7b
Original commit message: [LTS-M86][compiler][x64] Fix bug in InstructionSelector::ChangeInt32ToInt64 (cherry picked from commit 02f84c745fc0cae5927a66dc4a3e81334e8f60a6) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1196683 Change-Id: Ib4ea738b47b64edc81450583be4c80a41698c3d1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2820971 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#73903} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2821959 Commit-Queue: Jana Grill <janagrill@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#75} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@3066b7b
Original commit message: [LTS-M86][compiler][x64] Fix bug in InstructionSelector::ChangeInt32ToInt64 (cherry picked from commit 02f84c745fc0cae5927a66dc4a3e81334e8f60a6) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1196683 Change-Id: Ib4ea738b47b64edc81450583be4c80a41698c3d1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2820971 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#73903} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2821959 Commit-Queue: Jana Grill <janagrill@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> Cr-Commit-Position: refs/branch-heads/8.6@{#75} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@3066b7b PR-URL: #38275 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
ref #66
Also, I did notice that
domain.dispose()
is deprecated but missing a deprecation message. So it includes a commit which fixes it. Please inform me if you want it as a separate pull request.I've also changed two test assertions. I belive usage of domain in
lib/repl.js
was swallowing the assert errors and that those are currently broken.