-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
incomplete stack #31297
Comments
The Think about it, if f calls g as in |
I think OP is talking about @CTimmerman The function is not in the stack trace because the error is thrown asynchronously, so the context where the error is constructed is outside your function. If you replace it with any asynchronous function that takes a callback (for example Theoretically, Node.js can internally save the call stack info upon an asynchronous function scheduling and, if an error occurs, throw the error with reconstructed stack trace, or use async stack traces. However, it may have a large performance impact (see #30944 for example).
No, that issue is unrelated. |
I don't see how remembering the place where the async function was started would cause a significant performance issue. |
Capturing call stacks isn't free: it takes time and memory linear to the depth of the stack. That memory is the sticking point: it needs to stay around until the promise isn't observable anymore; effectively, until the promise is garbage-collected. |
True, hence adding a single line to the stack, and maybe a "..." for the millions of skipped ones you seem to imply, should make the stack useful again. Also the same problem happens when the containing function is async:
|
Even a single-frame call stack isn't cheap (enough). If it was, we would have done it a long time ago. There's plenty of infrastructure for long stack traces (async_hooks, the inspector) and several npm modules exist that utilize it but it's not enabled by default. See #31080 for a proposal. |
That's a stack frame i don't care about so would prefer to see this:
|
Maybe a duplicate of #11865 but that's closed and the issue still occurs with Node 13 on https://npm.runkit.com/
The text was updated successfully, but these errors were encountered: