Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run node.js by pm2,but often restart:exited with code [0] via signal [SIGINT]

I am trying to run node.js on my system but running into this problem:

2016-06-01 20:46:28: App [app] with id [13] and pid [12633], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:28: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-01 20:46:28: App name:app id:13 online
2016-06-01 20:46:28: App name:app id:4 disconnected
2016-06-01 20:46:28: App [app] with id [4] and pid [47284], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:28: Starting execution sequence in -cluster mode- for app name:app id:4
2016-06-01 20:46:29: App name:app id:4 online
2016-06-01 20:46:44: App name:app id:3 disconnected
2016-06-01 20:46:44: App [app] with id [3] and pid [42456], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:44: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-01 20:46:44: App name:app id:3 online
2016-06-01 20:46:45: App name:app id:2 disconnected
2016-06-01 20:46:45: App [app] with id [2] and pid [47045], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:45: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-01 20:46:45: App name:app id:2 online
2016-06-01 20:46:49: App name:app id:6 disconnected
2016-06-01 20:46:49: App [app] with id [6] and pid [47326], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:49: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-01 20:46:49: App name:app id:6 online
2016-06-01 20:46:49: App name:app id:10 disconnected
2016-06-01 20:46:49: App [app] with id [10] and pid [47291], exited with code [0] via signal [SIGINT]
2016-06-01 20:46:49: Starting execution sequence in -cluster mode- for app name:app id:10
2016-06-01 20:46:49: App name:app id:10 online
2016-06-01 20:48:33: App name:app id:2 disconnected

I run node.js using pm2, but it often restarts because of the following: exited with code [0] via signal [SIGINT]. Why is this?

Some additional information:

~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       40G  9.8G   28G  27% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            7.9G  4.0K  7.9G   1% /dev
tmpfs           1.6G  380K  1.6G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.9G     0  7.9G   0% /run/shm
none            100M     0  100M   0% /run/user

~$ free -m
 total       used       free     shared    buffers     cached
Mem:         16035       8177       7857          0        174       3672
-/+ buffers/cache:       4331      11704
Swap:            0          0          0

~$ node -v
v5.1.1

~$ npm -v
3.3.12
like image 749
chelsh Avatar asked Dec 18 '22 16:12

chelsh


1 Answers

I was having the same issue where pm2 was restarting every second and uptime was 0s. I found a work around:

  1. pm2 start bin/www -i 0 // this will start a cluster and the main app
  2. pm2 stop 0 // this will allow the cluster to keep running
like image 95
Alex Avatar answered Dec 28 '22 18:12

Alex