When the Node.js process can exit () directly without raising other signal events (uncaughtException, SIGINT, SIGTERM ...)

I am working on a REDIS datastore application. To preserve data integrity, I would like to empty the repository at the end of the process.

I created a function handler and linked it (with process.on ()) to signal events: uncaughtException, SIGINT, SIGTERM, SIGQUIT, and it works well (CTRL + C, process processing, exception, ...).

But I read that under certain conditions, a process can exit directly without triggering other signal events.

The problem in this particular case is that the process.on ('exit') handler can only handle synchronous tasks.

I did different tests to try to kill the process in different ways. And (except for SIGTERM on Windows) I could not determine the case where process.on ('exit') is started directly without SIGINT, SIGTERM or another event.

So my question is (on a Linux system) under what conditions can a process exit directly without triggering this event: http://nodejs.org/api/all.html#all_signal_events

+7
exit
source share
2 answers

At the moment, reading the docume ntation and doing re search , it seems that there are only four ways to exit node.js:

As a rule, someone does not understand the error message from uncaughtException and mistakenly believes that it is "something else" that killed node.js.

+7
source share

Really. I just wanted to indicate that Node programs might exit due to a signal without executing a handler (if no one has been registered). Rereading my post, I see that this may be what you had in mind.

0
source share

All Articles