Skip to content

node_api: fix uncaught exceptions in async worker - #19336

Closed
mafintosh wants to merge 2 commits into
nodejs:masterfrom
mafintosh:n-api-uncaught-worker
Closed

node_api: fix uncaught exceptions in async worker#19336
mafintosh wants to merge 2 commits into
nodejs:masterfrom
mafintosh:n-api-uncaught-worker

Conversation

@mafintosh

@mafintoshmafintosh commented Mar 14, 2018

Copy link
Copy Markdown
Member
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-botnodejs-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
mafintoshforce-pushed the n-api-uncaught-worker branch from cab3960 to 6465517CompareMarch 14, 2018 02:23
@mafintoshmafintosh changed the title n-api fix uncaught exceptions in async workernode_api: fix uncaught exceptions in async workerMar 14, 2018

@richardlaurichardlau left a comment

Copy link
Copy Markdown
Member

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
mafintoshforce-pushed the n-api-uncaught-worker branch from 6465517 to b082520CompareMarch 14, 2018 21:56
@mafintosh

Copy link
Copy Markdown
MemberAuthor

@richardlau fixed

@mafintosh

Copy link
Copy Markdown
MemberAuthor

Was fixed by my other PR

Sign up for freeto 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 / srcIssues 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

@mafintosh@jasnell@addaleax@richardlau@nodejs-github-bot