-
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
errors: strange position name in error stack #15386
Comments
I think it's a bug. Here is the output with Result: Got true
Result: Got true
Result: Got true
Error: Got false
at promiseHandlers (/home/mzasso/test/stack.js:6:17)
at Promise (<anonymous>)
at promiseFunc (/home/mzasso/test/stack.js:4:10)
at asyncFunc (/home/mzasso/test/stack.js:15:11)
at <anonymous>
Error: Got false
at promiseHandlers (/home/mzasso/test/stack.js:6:17)
at Promise (<anonymous>)
at promiseFunc (/home/mzasso/test/stack.js:4:10)
at /home/mzasso/test/stack.js:27:11
at <anonymous>
Error: Got false
at promiseHandlers (/home/mzasso/test/stack.js:6:17)
at Promise (<anonymous>)
at promiseFunc (/home/mzasso/test/stack.js:4:10)
at /home/mzasso/test/stack.js:39:11
at <anonymous> |
OK this is a V8 bug. Repro for (function (param1) {
(async () => {
try {
await Promise.reject(new Error('boom'));
} catch (err) {
console.error(err.stack);
}
})();
})(); Error: boom
at param1 (problem.js:5:28)
at problem.js:9:5
at problem.js:11:3 /cc @nodejs/v8 |
It does not have to be an async function btw: (function (param1) {
(() => {
try {
throw new Error('boom');
} catch (err) {
console.error(err.stack);
}
})();
})(); Error: boom
at param1 (problem.js:5:13)
at problem.js:9:5
at problem.js:11:3 |
@targos So is the output in the OP somehow connected with module wrapper last argument? |
Exactly. The bug is that the stack trace uses the name of the last argument of the outer function in place of the name of the function, when that function is a arrow function. |
@targos Do you plan to post upstream or should I try to? |
You're welcome to do it: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js+upstream+bug |
Hopefully done. Should we close this issue or should it remain open till upstream fix? |
Let's keep it open until we know if the fix can be backported |
FWIW, the output from maintained branches (Node.js v6 with v8 5.1 seems concerned in a different way): 'use strict';
(function (param1) {
(() => {
try {
throw new Error('boom');
} catch (err) {
console.error(err.stack);
}
})();
})(); > node.4.8.4.v8-4.5.exe test.js
Error: boom
at e:\DOC\prg\js\node\-test\test.js:7:13
at e:\DOC\prg\js\node\-test\test.js:11:5
at Object.<anonymous> (e:\DOC\prg\js\node\-test\test.js:13:3)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
> node.6.11.3.v8-5.1.exe test.js
Error: boom
at err (e:\DOC\prg\js\node\-test\test.js:7:13)
at e:\DOC\prg\js\node\-test\test.js:11:5
at Object.<anonymous> (e:\DOC\prg\js\node\-test\test.js:13:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
> node.8.5.0.v8-6.0.exe test.js
Error: boom
at param1 (e:\DOC\prg\js\node\-test\test.js:7:13)
at e:\DOC\prg\js\node\-test\test.js:11:5
at Object.<anonymous> (e:\DOC\prg\js\node\-test\test.js:13:3)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:201:16) |
This was fixed in https://chromium-review.googlesource.com/c/v8/v8/+/742657 |
Any idea on which Node.js version(s) this will be included in? (I apologize if that's something I should have known how to google.) |
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} Refs: v8/v8@c3458a8 Closes: nodejs#15386
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#49042} PR-URL: #18060 Fixes: #15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#18060 Fixes: nodejs#15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#16413 Fixes: nodejs#15386 Refs: v8/v8@c3458a8
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#18060 Backport-PR-URL: nodejs#16413 Fixes: nodejs#15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#16413 Refs: v8/v8@c3458a8 Closes: nodejs#15386
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#18060 Backport-PR-URL: nodejs#16413 Fixes: nodejs#15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#49042} PR-URL: #18059 Closes: #15386 Fixes: #15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#18060 Fixes: nodejs#15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#49042} PR-URL: #18060 Backport-PR-URL: #16413 Fixes: #15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Compare these 3 async IIFEs and their error stacks (different code lines and corresponded stack position names are marked by
// NB
string):Is
__dirname
position name in the last stack intended?The text was updated successfully, but these errors were encountered: