javascript - pm2运行node.js,但是经常重启:exited with code [0] via signal [SIGINT]

标签 javascript node.js pm2

我试图在我的系统上运行 node.js 但遇到了这个问题:

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

我使用 pm2 运行 node.js,但由于以下原因它经常重新启动:通过信号 [SIGINT] 以代码 [0] 退出。这是为什么?

一些附加信息:

~$ 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

最佳答案

我遇到了同样的问题,pm2 每秒重新启动一次,正常运行时间为 0。我找到了解决办法:

  1. pm2 start bin/www -i 0//这将启动集群和主应用
  2. pm2 stop 0//这将允许集群继续运行

关于javascript - pm2运行node.js,但是经常重启:exited with code [0] via signal [SIGINT],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37612081/

相关文章:

node.js - 在nodejs中使用ES模块时PM2崩溃

javascript - 使 rails 中的 javascript 库保持最新的最佳方法是什么?

node.js - 为什么我的 lambda 函数没有按预期工作?

javascript - 从逗号分隔的句子中选择整个单词

node.js - 使用 Nodejs pm2 扩展服务器时端口如何工作

node.js - 在 Win ES 7 上使用 PM2 运行 node-red 时为 "SyntaxError: Invalid or unexpected token"

javascript - 为什么我的 javascript 地理编码函数返回空白结果?

javascript - 下拉菜单不会保持打开状态 bootstrap 4

javascript - 使用 Google Apps 脚本和 JavaScript 从 google 表中反射(reflect) HTML 中的选项值

javascript - 在 Meteor.js 上返回多个游标