Skip to content

Confusing stack trace when using --abort-on-uncaught-exception #21988

Closed
@mmarchini

Description

@mmarchini
  • Version: master
  • Platform: OS X
  • Subsystem: errors

When using --abort-on-uncaught-exception, all lines in the stack trace appear as 1:1 instead of the actual line and column numbers.

function main() {
  throw new Error();
}

main();

If we run the above script, we'll get:

$ node e.js
/Users/mmarchini/workspace/nodejs/node/e.js:2
  throw new Error();
  ^

Error
    at main (/Users/mmarchini/workspace/nodejs/node/e.js:2:9)
    at Object.<anonymous> (/Users/mmarchini/workspace/nodejs/node/e.js:5:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

But if we run it with --abort-on-uncaught-exception, the result is quite different (for example, main (./e.js:1:1) instead of main (./e.js:2:9)):

Uncaught Error

FROM
main (/Users/mmarchini/workspace/nodejs/node/e.js:1:1)
Object.<anonymous> (/Users/mmarchini/workspace/nodejs/node/e.js:1:1)
Module._compile (module.js:1:1)
Object.Module._extensions..js (module.js:1:1)
Module.load (module.js:1:1)
tryModuleLoad (module.js:1:1)
Function.Module._load (module.js:1:1)
Function.Module.runMain (module.js:1:1)
startup (bootstrap_node.js:1:1)
bootstrap_node.js:1:1
[1]    94600 illegal hardware instruction  node --abort-on-uncaught-exception e.js

At first I thought it was a V8 bug, but running the same script with d8 gives the expected result:

Uncaught Error

FROM
main (e.js:2:3)
e.js:5:1

Maybe it's something related to our modules system? cc @nodejs/modules

Metadata

Metadata

Assignees

No one assigned

    Labels

    post-mortemIssues and PRs related to the post-mortem diagnostics of Node.js.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions