So I have a nodejs server running with forever, and sometimes it crashes and gives me an error like it should. But sometimes it just crashes and doesnt log me an error(so in the log it cuts off the old log and logs a new "server started"-line, which confirms that it crashed(or at least that forever has restarted it...)). The same happens when I'm not using forever.
I once managed to find one of those errors by sheer coincedence and it was in a pretty big switch(){} which was in a socket.on() event of socket.io. Might that be related?
This is really annoying, I can fix the error if I know where it is, but like this I cant know where it is.
Also I've tried using process.on("UncaughtException"...) without success, still just crashed without giving me the error.
This is already all I know about it, if I knew more I wouldn't have to ask for help here. However since some of you requested it I will include further information, which is pretty much anything I can tell you that could possibly be slightly related/helpful:
By normal crashing and logging I mean that what it normally logs ends and it gives me something like:
util.js:35 var str = String(f).replace(formatRegExp, function(x) { ^ RangeError: Maximum call stack size exceeded
Just an example, was an error that happened long ago and that I managed to fix.
So what I am experiencing is a crash without something like the above being logged, just nodejs crashing and getting restarted by forever.
The one error I once managed to find was a value being compared with another value(if(value<=value2)), however sometimes said value would be undefined, what (for some reason) resulted in such logless crash.
Also my program basically consist of a socket.io server handling requests, sending packets to clients, managing a small mmo with an included chat, which also accepts commands(the one error I once found was inside the switch statement which checks messages for commands). The second part is a virtual client, which is a gameloop that works the same way as the gameloop on the client, but without graphics. Right now it runs with setInterval, and it used to run with setTimeout. For some reason those logless errors happen alot more often eversince I made the gameloop use setInterval rather than setTimeout. But(as explained above) some of them arent in said gameloop.
The modules for node I am using are:
Personally I can hardly help someone who ask something like:
sometimes it just crashes
I consider myself as a magician, but I'm no god. There are many cases where your Node.Js may seems like it fails and you have no feedback, and you get mad to Node. For me it has most alway been an behind the keyboard issue (like not calling the output callback).