GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||
GeezerVison is showing github.com — util: expose promise events by devsnek · Pull Request #21857 · nodejs/node Conversation
|
|
@devsnek build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/296/pipeline |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This would technically need to be swapped with the line above (it’s only working because we’re doing an evil hack and look into V8’s object representations to load persistent references faster)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don’t think it really makes sense to add NODE_EXTERN to a type definition; also, the typedef is redundant, just using enum PromiseHookType { … }; should work the same way
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
this doesn't compile without the typedef
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is backwards incompatible and will break code for a worse off default.
This also goes against the ongoing work we've been doing at @nodejs/promises-debugging and the work.
I am strictly -1 on this change before the survey we've been working on with the foundation is sent out and we've gathered sufficient data.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This is also not true and was not the intention - browsers error on unhandled rejections too. One of the things we've been getting since adding the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It would have been great to discuss things like that in the promises working group. Since this is completely backwards incompatible I am strongly -1. It is not an option to remove the regular way how people deal with this. AFAIK it is also not possible to mirror the current implementation in userland even with the events exposed. I believe it is best to keep these things in core so everyone takes advantage of it by default. Opt-out instead of opt-in. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
-1 due to the mentioned reasons.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
By hte way: By the same logic we should deprecate |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
i can add the as to the argument about how promises are supposed to work: they are explicitly intended to be able to silently fail. what browser consoles do is completely irrelevant because that's a debug facility. (we could probably do the same thing with our inspector, which would be also fine) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
i tried to design this with that in mind ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@benjamingr browsers provide a console warning on unhandled rejections, which they then retroactively erase if it becomes handled - node doesn't have that capability. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I do not believe this is the case nor does the spec make any such requirement. That said: Under all proposed implementations promises are able to silently fail - just like you can ignore synchronous errors: process.on('uncaughtException', e => { /* console.log('https://i.imgur.com/c4jt321.png') */ }); You can ignore unhandled rejections: process.on('uncaughtException', e => { /* console.log('https://i.imgur.com/c4jt321.png') */ }); Which will continue to work forever under all proposed changes. The question is about what the default behaviour should be. We have a consensus at this point in Node.js that ignoring uncaught errors should not be the default behaviour.
Again, the same argument could be made for Node.js not exiting on uncaught errors. Since a significant part of our user-base use |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The browser error handling model is completely different though - Node.js crashes on uncaught errors (by default) whereas browsers "chug on". Both behaviours have been this way for well over 8 years. I was just pointing out browsers consider unhandled rejections as an error and log based on it. Node.js provides the "erasing" by providing the "rejectionHandled" hook which I haven't actually seen ever used but it's possible and was added in the same PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
the spec says aside from that, these changes also mean that in the common case, nothing is slowed down by promise state tracking. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@devsnek I encourage you to read all the discussion above as well as the nodejs/promises repo discussions about this issue. The gist is:
In a gist the correct behaviour we settled on was:
It's not perfect - but sadly I think it's the best we might be able to do. You are encouraged to read the background discussions and participate in the promises-debugging team which still has an open "call for members". We'd love for more people to get involved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
That's not |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
the destroy hook lets us do that right? in any case, wasn't the whole point here to catch all the bad things happening? if we don't catch them we aren't solving the problem (with regard to gc) and having that as a default is imo confusing and misleading (not to mention that having all these promise state trackers by default is annoying) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f83beed to
ff94f4c
Compare
There was an error while loading. Please reload this page.
|
@benjamingr @BridgeAR unhandledRejection event remains. This PR still provides a solution to exposing the events requested in nodejs/promises-debugging#8 (and other fun stuff) i still strongly recommend against node defining what an unhandled rejection is in any case but that's a conversation for another issue/pr |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: This should likely be moved above the arguments list
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7ff1627 to
3dec7bb
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I've signed off both PR (this and #22218), but we should really reconcile them before landing either one. See @jasnell comment #22218 (comment). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@BridgeAR Same question as in the other PR: Can you explain what you'd like the TSC to decide or do with this at the meeting? (Or should we remove it from the agenda?) EDIT: Are you asking the TSC to decide whether we should go with this approach or #22218? Is it unlikely that you and @devsnek or others will come to an agreement on that? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If I've understood the conversation above, there are currently 3 objecting Collaborators on this PR: @benjamingr, @BridgeAR, and @AndreasMadsen. If I've misunderstood and any of you don't object to this at this time, please comment! Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Adding |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nodejs/tsc PTAL. @benjamingr your review doesn't show up anymore but i assume it is outdated. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Like Gus said, my review is outdated.Both this and the other PR LGTM.
|
Thanks everybody for putting so much work into this! Would somebody be willing to summarize #22218 and #21857 so it's easier to understand the pros and cons of the two approaches? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@devsnek This would at least need a rebase? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
that's more than I'm willing to do at this point. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.