node.js keep stopping. No errors logged.

March 10, 2015 702 views

Hi all

I am running ubuntu and use a node.js to run a small website.

I am starting the server using forever with the following:

forever start -l forever.log -o out.log -e error.log server.js

It starts fine with some warning:

warn: --minUpTime not set. defaulting to 1000
warn: --spinSleepTime not set. Your script will exit if it does not stay up..

My experience with node is limited, so I not sure if these warning matter - they sound like they do.

The server will run fine with hardly any mem usage or load on the server.

It will last a few hours then just stop with nothing in the logs to indicate any problems.

Can anyone assist me, as I in despair on what it could be.?

Best wishes all


1 Answer

When using forever, --spinSleepTime is important to set. One of the key features of forever is that it will respawn your process if it dies for one reason or another. This only works if that option is set. It refers to the time to wait between launches of a script that is considered "spinning." It is in milliseconds. Using something like --spinSleepTime 10000 is usually a good default.

Have another answer? Share your knowledge.