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

node_api: fix uncaught exceptions in async worker #19336

Closed
wants to merge 2 commits into from

Conversation

mafintosh
Copy link
Member

@mafintosh mafintosh commented Mar 14, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This fixes an issue with n-api where an uncaught exception triggered in the async worker callback
would lead to js weirdness or node panics.

The main issue was we were calling js functions after doing isolate->ThrowException which the v8 documentation states is illegal

Fix is to simply use the other FatalException interface which allows passing in the local value and message directly.

I've added a test that showcases the problem as well (panics on my machine)

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Mar 14, 2018
@mafintosh mafintosh changed the title n-api fix uncaught exceptions in async worker node_api: fix uncaught exceptions in async worker Mar 14, 2018
Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

For consistency, the subsystem should be n-api.

@mafintosh
Copy link
Member Author

@richardlau fixed

@mafintosh
Copy link
Member Author

Was fixed by my other PR

@mafintosh mafintosh closed this Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants