2

I'm using upstart to launch a daemon to run a node.js (using express and connect-redis) http and https server (in the same node .js file) per

http://kevin.vanzonneveld.net/techblog/article/run_nodejs_as_a_service_on_ubuntu_karmic/

Everything is fine at startup and all app functionality appear to work as expected, but consistently, after varying duration (sometimes after a few hours, sometimes after a day), the daemon process gets killed and the only log I have of it is found in

daemon.log:

myserver init: myupstartscript main process (3410) killed by ABRT signal

in my node js file, I've placed:

process.on('uncaughtException',...);
process.on('SIGABRT', .... );
process.on('ABRT',...);

none of which catch the event.

I don't know how to simulate the event. When I tried using

kill -SIGABRT [the pid]
kill -ABRT [the pid]

my process.on('SIGABRT',..) catches those.

Other things I've noticed:

  • If I run the service WITHOUT the https server, the crash never happens.
  • Based on my other logs, the crash does NOT result from a user triggered event
  • None of the other app specific services I'm relying on (redis-server, mongod) appear to be related to the event, they continue servicing as normal.
  • I've set the upstart script to respawn upon crash, and it does so.

Any help on how I might trace it?

My setup: Linux iLV1 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux node v0.5.11-pre

Thanks.

Ray
  • 360
  • 3
  • 8

1 Answers1

1

If you want to catch node on exit use

process.on('exit', function () {
  console.log('About to exit.');
});
Tim P.
  • 421
  • 4
  • 10
  • Thanks, but I'm actually trying to prevent the exit caused by the abort signal if possible or find out the cause by logging some data about the event. For now, I'm auto respawning it with upstart, but I'd rather handle it inside node if I could. – Ray Jan 04 '12 at 17:00
  • Hey - I'm facing this too, were you able to get to solving this? Assuming this to be memory leak or to loading too much into memory than what is configured in Linux sysctl. – Shamasis Bhattacharya Jan 09 '16 at 11:31