Skip to content
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

doc: add --abort-on-uncaught-exception + vm note #17389

Closed
wants to merge 1 commit into from

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Nov 29, 2017

The --abort-on-uncaught-exception flag is not compatible with error handling involving the vm module. This is because V8 treats exceptions thrown from a VM as unhandled, and cause the process to abort. This commit adds a note to work around the issue using process.setUncaughtExceptionCaptureCallback().

Fixes: #13258

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

The --abort-on-uncaught-exception flag is not compatible with
error handling involving the vm module. This is because V8 treats
exceptions thrown from a VM as unhandled, and cause the process
to abort. This commit adds a note to work around the issue using
process.setUncaughtExceptionCaptureCallback().
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. vm Issues and PRs related to the vm subsystem. labels Nov 29, 2017
[`Error`]: errors.html#errors_class_error
[`eval()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It landed this morning so will need another night to pass :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry.

@addaleax
Copy link
Member

addaleax commented Nov 29, 2017

Or wait. Maybe this should be an option on the vm.run*() methods? @cjihrig Do you think you’d prefer that? It should be pretty easy (or easy enough) to implement…

@cjihrig
Copy link
Contributor Author

cjihrig commented Nov 29, 2017

@addaleax I proposed that in #13258 (comment), but didn't really receive any feedback in favor. If you're on board, I could go that route.

If I were to implement it as an option, I'd probably just toggle the C++ flag when running the vm code, not take a user provided function.

@addaleax
Copy link
Member

@cjihrig I was thinking an shouldAbortOnUncaughtException: boolean option on that object, not a function, with defaulting to false (or true and later flip to false if we’re worried about breakage). I’ll get a PR ready in a bit.

@cjihrig cjihrig closed this Nov 29, 2017
@cjihrig cjihrig deleted the vm branch November 29, 2017 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants