3

We are trying to deploy one of our node js applications(AngularJS/NodeJS tech stack) to Production environment. Randomly, some of the ec2 instances just goes down as node process is getting killed. But no application/system level error messages are getting logged. We are unable to replicate this issue in local/dev/it environments. Has anyone faced something similar? Any help is much appreciated. Thanks!

Mannu
  • 65
  • 6
  • How are you starting the NodeJS processes? You probably need to look into using a service like Forever: https://github.com/foreverjs/forever – Mark B Apr 27 '16 at 20:39
  • We are starting node js server using nohup command in the background. – Mannu Apr 28 '16 at 14:41
  • that won't restart the Node process if an exception causes the process to exit. You need to just install Forever and use that. – Mark B Apr 28 '16 at 14:51
  • I am seeing the same behavior. Nodejs process randomly disappears, nothing in the log. Wonder if aws is the culprit... – obai Sep 09 '16 at 03:00

2 Answers2

4

I know this is an old question, just in case someone else run into the same problem.
Most probably is that your a running out of memory, as explained here. You can verify with dmesg command (linux). To fix it you can add more memory or add a swap volume.
One way is following this answer:

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
// enable after reboot
/var/swap.1 swap swap defaults 0 0
Hosar
  • 5,163
  • 3
  • 26
  • 39
-2

By default, nodejs application would be stopped when no client connect to it, you could use some tools like forever to keep your nodejs app running

MarkoCen
  • 2,189
  • 13
  • 24