You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling N-API based async code (in particular written with none-addon-api) from a process exit hook process.on("exit") it leads to a fatal error.
This is very easy to reproduce. For example, take the asyncworker.js tests and put the last block within a process.on("exit") callback. Like this
Running as node --expose-gc test/asyncworker.js the process is aborted and I see the following stack trace. Tested with Node.js 12.12.0 on macOS 10.14.
any async code to not be called anymore and the process to exit cleanly, or
(edit) a user-friendly JS exception to be thrown
I am running into this issue with zeromq.js, where I can't control users calling into the native code from an exit hook and this leads to similar fatal errors. Maybe there could be a way to check if the process/thread is exiting from within the native code?
When calling N-API based async code (in particular written with
none-addon-api) from a process exit hookprocess.on("exit")it leads to a fatal error.This is very easy to reproduce. For example, take the
asyncworker.jstests and put the last block within aprocess.on("exit")callback. Like thisRunning as
node --expose-gc test/asyncworker.jsthe process is aborted and I see the following stack trace. Tested with Node.js 12.12.0 on macOS 10.14.I would expect:
I am running into this issue with zeromq.js, where I can't control users calling into the native code from an exit hook and this leads to similar fatal errors. Maybe there could be a way to check if the process/thread is exiting from within the native code?