S
S
Sergey Sokolov2017-03-20 08:22:40
linux
Sergey Sokolov, 2017-03-20 08:22:40

Why is Node.js dying without messages?

On the server, I run nodejs through nohup something like this:
nohup node main.js >>my.log 2>&1 &
But for the second time it crashes, and there are no entries about the error in the log.
CentOS 6.7, node 4.4.0. The script is simple, it has no planned exits.
CHYADNT and where to complain?
PS Asynchronous errors are fine in the log file. proof:
05ec18b334a345da80daa81399f5acaf.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2017-03-20
@vshvydky

A crash without an error occurs where errors are not caught in asynchronous mode, apparently you do not follow the try catch recommendation.
Since the author does not believe, here is the code:

const test = ()=>{
    return new Promise((resolve, reject) =>{
        new_error();
        resolve(true);
    });
};


test();

, here is the output on node 4.4
>node test2.js
>
Clean and no errors.
And this is not the only case where the error will be eaten. And yes, in the 7.8 era, use 4.4 bad manners.
By the way, node 7 will already give a warning:
(node:13428) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): true
(node:13428) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zer
o exit code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question