I have a NodeJS server running in the background that I start with:
NODE_ENV=production npm start >> stdout.txt 2>> stderr.txt &
When I restart it with:
kill <node process id>; NODE_ENV=production npm start >> stdout.txt 2>> stderr.txt &
I sometimes see a long error in the logs:
/opt/bitnami/nodejs/bin/.node.bin[8878]: ../src/node.cc:663:void node::ResetStdio(): Assertion `(0) == (err)' failed. 1: 0x9ef190 node::Abort() [/opt/bitnami/nodejs/bin/.node.bin] 2: 0x9ef217 [/opt/bitnami/nodejs/bin/.node.bin] 3: 0x9bd657 node::ResetStdio() [/opt/bitnami/nodejs/bin/.node.bin] 4: 0x9bd6c0 node::SignalExit(int) [/opt/bitnami/nodejs/bin/.node.bin] 5: 0x7fca6718e390 [/lib/x86_64-linux-gnu/libpthread.so.0] 6: 0x7fca66ebaad3 epoll_wait [/lib/x86_64-linux-gnu/libc.so.6] 7: 0x13200b0 [/opt/bitnami/nodejs/bin/.node.bin] 8: 0x130e26b uv_run [/opt/bitnami/nodejs/bin/.node.bin] 9: 0xa31ec3 node::NodeMainInstance::Run() [/opt/bitnami/nodejs/bin/.node.bin] 10: 0x9c1cc8 node::Start(int, char**) [/opt/bitnami/nodejs/bin/.node.bin] 11: 0x7fca66dd3840 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6] 12: 0x95c085 [/opt/bitnami/nodejs/bin/.node.bin] Aborted (core dumped) npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! App@0.0.1 start: `node app.js` npm ERR! Exit status 134 npm ERR! npm ERR! Failed at the App@0.0.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/bitnami/.npm/_logs/2020-12-17T21_05_41_838Z-debug.log npm[8862]: ../src/node.cc:663:void node::ResetStdio(): Assertion `(0) == (err)' failed. 1: 0x9ef190 node::Abort() [npm] 2: 0x9ef217 [npm] 3: 0x9bd657 node::ResetStdio() [npm] 4: 0x7fd18c8c7008 [/lib/x86_64-linux-gnu/libc.so.6] 5: 0x7fd18c8c7055 [/lib/x86_64-linux-gnu/libc.so.6] 6: 0x994907 [npm] 7: 0xbc9a29 [npm] 8: 0xbcb817 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [npm] 9: 0x13a72b9 [npm]
and sometimes I see a short error:
Terminated npm ERR! code ELIFECYCLE npm ERR! errno 143 npm ERR! App@0.0.1 start: `node app.js` npm ERR! Exit status 143 npm ERR! npm ERR! Failed at the App@0.0.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/bitnami/.npm/_logs/2020-12-17T21_06_43_530Z-debug.log
What is the difference between the two, and what is the best way to restart a NodeJS server?