-
Notifications
You must be signed in to change notification settings - Fork 29.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
Wrong async stack trace #30822
Comments
@nodejs/v8 this seems to an issue with V8 and I am able to reproduce it in the dev tools as well. Simplified test case (without anything Node.js specific): async function bar() {
// throw new Error('Good stack trace')
try {
await Promise.reject(new Error('Good stack trace'))
} catch (e) {
console.log(e)
throw new Error('Wrong stack trace')
}
}
async function run() {
await bar()
}
run().then(() => console.log('success'), error => console.error(error)) |
@BridgeAR could you please file this issue upstream? |
Fixing this in https://chromium-review.googlesource.com/c/v8/v8/+/1969897 |
@verwaest I also opened an issue for it on the V8 issue tracker a couple of days ago: https://bugs.chromium.org/p/v8/issues/detail?id=10040 |
Also capture async stack traces if we're in a reject handler. Fixes node issue nodejs/node#30822 Change-Id: I703012ddb88b5b5d17baba843a969b398ef99fa1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1969897 Auto-Submit: Toon Verwaest <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#65687}
@BridgeAR could you please have a look?
Bad stack trace (if two iterations and more):
|
That's basically the same. The first iteration (after my fix) you still get a complete stack trace because you're still executing synchronously when the error object is created. The await isn't executed yet. Any iteration after that now includes the first (anonymous) function, where it didn't before the fix. |
Fixed in V8. |
Version: v13.3.0
Platform: Windows 7x64 and Ununtu 18.04 Linux 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
This fragment of code:
generates wrong stack trace:
If we replace try-catch block with simple
throw new Error('Good stack trace')
, stack trace will be normal:The text was updated successfully, but these errors were encountered: