-
Notifications
You must be signed in to change notification settings - Fork 19
Action Items #26
Comments
Brain dump to explore on async stack traces in production. Stack traces are expensive because of
The latter two can maybe solved by caching the (code x code offset) -> list of (script x source position) mapping. We already perform caching of Both can also be made cheaper by performing lazily. (3) is fairly straightforward to perform lazily. (2) is a bit more complicated because the deopt info is thrown away when we deoptimize the optimized code. We could also explore collecting the stack trace (1) in generated code. |
Pointers for doing the spec change:
|
Thanks for the mention Benjamin, really appreciate it! How would you like to start/continue the conversation? |
Well, I think we should set up a call with interested parties to write down where we currently are and where we want to get - as well as what changed since the last time.
Given the fact promises happened, I would like to get a better understanding of what we can do to give Node.js users a better post-mortem story. I think a major limitation at the moment is that most of the core people working on promises don't have experience working with post-mortem tools and the community has generally not been asking for this (as a whole). I wonder if a CoW fork for core dump when a rejection happens synchronously + the 'don't wait for more microtick' semantics would be the best we can do. Also interested if @uzon has any conclusions from their work on the topic from nodejs/post-mortem#45 . @littledan also has an interesting idea in nodejs/post-mortem#45 (comment) |
Will you be able to hook in and trap an accidental exception (not an explicit |
Do you mean something like https://github.com/nodejs/promise-use-cases/blob/master/use-cases/warnings/3/3.md ? I believe we've discussed it and agreed it would be interesting to make this detectible via tooling. I'll edit it in, thanks for noticing |
No, I mean this: https://github.com/nodejs/promise-use-cases/blob/master/use-cases/user-expectations/6/expectations-6.md
These two may currently have the same outcome, but my argument in that linked document is that the user actually has different expectations between them. We should ideally provide ways to not only trap both for both cases, but also identify which case has happened, and maybe even deal with them differently. new Promise(function c(resolve){
resolve(42);
reject();
throw "uncaught";
}); new Promise(function c(resolve){
resolve(42);
misspelled();
}); What I'm saying is, the unexpected/accidental JS exception in the latter snippet, thrown when I try to call a misspelled function, is something I'd like at a minimum to be able to trap for with a hook instead of it being swallowed... but ideally (as argued in that linked document), I'd liked to configure Promises via a flag so that this latter promise actually ended up rejected with the JS exception. |
@benjamingr Let's set up a call to discuss further -- what times work for you? |
@yunong can you make a separate issue for postmortem? I think we should make a doodle to give other interested parties a chance to participate :) |
I think it could furthermore be argued that both of these: new Promise(function c(resolve){
resolve(42);
throw "oops";
}); new Promise(function c(resolve){
resolve(42);
oops();
}); Should result (perhaps through opt-in via a flag) in an "uncaughtException" event (not "unhandledRejection") being fired in Node. By contrast, this: new Promise(function c(resolve,reject){
resolve(42);
reject("oops");
})
.catch(e => e); ...could be argued should (via opt-in) still report an "unhandledRejection". |
@getify from what I understood neither would report an |
@benjamingr OK, as long as the (second) snippet accidentally calling And ideally, that hook would receive some sort of signal or information that told you how it was raised -- via which of those 3 approaches? -- since you might want to do different things depending on how it was raised. |
Got it, let's discuss this again once V8 work on their hooks reimplementation and support for this to discuss specifics. (I am assuming |
It's a placeholder illustration of any sort of valid JS code that for whatever reason causes an unexpected runtime JS exception, such as a TypeError or ReferenceError. |
Closing this issue because the repository is being archived: nodejs/admin#283 |
throw
s in thenew Promise
constructor - where either we provide a hook for multiple resolutions users can use or to change the behavior of the promise constructor to onlyresolve
after the constructor has run (still synchronously, but anythrow
s take precedence).https://github.com/nodejs/promise-use-cases/pull/21/files - cc @getify
new Promise
constructorawait
happens so libraries can/might be able to hook with it. (Would be cool if the hook would allow some form of interception?)%RunMicrotasks
under a--dangerous-only-for-experimentation-this-will-burn-your-house-asynchronously
. Experiment with how people are using it and based on that propose further action items.The text was updated successfully, but these errors were encountered: