pm2的log:
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
2016-06-01 20:48:33: App [app] with id [2] and pid [47436], exited with code [0] via signal [SIGINT]
2016-06-01 20:48:33: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-01 20:48:33: App name:app id:2 online
2016-06-01 20:48:33: App name:app id:1 disconnected
2016-06-01 20:48:33: App [app] with id [1] and pid [47215], exited with code [0] via signal [SIGINT]
2016-06-01 20:48:33: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-01 20:48:33: App name:app id:1 online
2016-06-01 21:44:32: App name:app id:3 disconnected
2016-06-01 21:44:32: App [app] with id [3] and pid [47425], exited with code [0] via signal [SIGINT]
2016-06-01 21:44:32: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-01 21:44:32: App name:app id:3 online
2016-06-01 22:41:52: App name:app id:1 disconnected
2016-06-01 22:41:52: App [app] with id [1] and pid [47518], exited with code [0] via signal [SIGINT]
2016-06-01 22:41:52: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-01 22:41:52: App name:app id:1 online
2016-06-01 22:41:55: App name:app id:8 disconnected
2016-06-01 22:41:55: App [app] with id [8] and pid [13399], exited with code [0] via signal [SIGINT]
2016-06-01 22:41:55: Starting execution sequence in -cluster mode- for app name:app id:8
2016-06-01 22:41:55: App name:app id:8 online
2016-06-01 23:11:27: App name:app id:11 disconnected
2016-06-01 23:11:27: App [app] with id [11] and pid [47254], exited with code [0] via signal [SIGINT]
2016-06-01 23:11:27: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-01 23:11:28: App name:app id:11 online
2016-06-02 10:32:31: App name:app id:12 disconnected
2016-06-02 10:32:31: App [app] with id [12] and pid [40234], exited with code [0] via signal [SIGINT]
2016-06-02 10:32:31: Starting execution sequence in -cluster mode- for app name:app id:12
2016-06-02 10:32:31: App name:app id:12 online
2016-06-02 11:11:13: App name:app id:7 disconnected
2016-06-02 11:11:13: App [app] with id [7] and pid [47386], exited with code [0] via signal [SIGINT]
2016-06-02 11:11:13: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 11:11:13: App name:app id:7 online
2016-06-02 11:11:16: App name:app id:6 disconnected
2016-06-02 11:11:16: App [app] with id [6] and pid [47447], exited with code [0] via signal [SIGINT]
2016-06-02 11:11:16: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-02 11:11:16: App name:app id:6 online
2016-06-02 12:29:17: App name:app id:0 disconnected
2016-06-02 12:29:17: App [app] with id [0] and pid [47317], exited with code [0] via signal [SIGINT]
2016-06-02 12:29:17: Starting execution sequence in -cluster mode- for app name:app id:0
2016-06-02 12:29:17: App name:app id:0 online
2016-06-02 14:24:11: App name:app id:2 disconnected
2016-06-02 14:24:11: App [app] with id [2] and pid [47511], exited with code [0] via signal [SIGINT]
2016-06-02 14:24:11: Starting execution sequence in -cluster mode- for app name:app id:2
2016-06-02 14:24:11: App name:app id:2 online
2016-06-02 14:57:33: App name:app id:5 disconnected
2016-06-02 14:57:33: App [app] with id [5] and pid [47302], exited with code [0] via signal [SIGINT]
2016-06-02 14:57:33: Starting execution sequence in -cluster mode- for app name:app id:5
2016-06-02 14:57:33: App name:app id:5 online
2016-06-02 15:15:23: App name:app id:13 disconnected
2016-06-02 15:15:23: App [app] with id [13] and pid [47393], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:23: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-02 15:15:23: App name:app id:13 online
2016-06-02 15:15:36: App name:app id:6 disconnected
2016-06-02 15:15:36: App [app] with id [6] and pid [64319], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:36: Starting execution sequence in -cluster mode- for app name:app id:6
2016-06-02 15:15:36: App name:app id:12 disconnected
2016-06-02 15:15:36: App [app] with id [12] and pid [63616], exited with code [0] via signal [SIGINT]
2016-06-02 15:15:36: Starting execution sequence in -cluster mode- for app name:app id:12
2016-06-02 15:15:36: App name:app id:6 online
2016-06-02 15:15:36: App name:app id:12 online
2016-06-02 15:17:24: App name:app id:13 disconnected
2016-06-02 15:17:24: App [app] with id [13] and pid [68616], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:24: Starting execution sequence in -cluster mode- for app name:app id:13
2016-06-02 15:17:24: App name:app id:13 online
2016-06-02 15:17:52: App name:app id:7 disconnected
2016-06-02 15:17:52: App [app] with id [7] and pid [64308], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:52: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 15:17:52: App name:app id:7 online
2016-06-02 15:17:57: App name:app id:9 disconnected
2016-06-02 15:17:57: App [app] with id [9] and pid [12429], exited with code [0] via signal [SIGINT]
2016-06-02 15:17:57: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 15:17:57: App name:app id:9 online
2016-06-02 15:18:08: App name:app id:7 disconnected
2016-06-02 15:18:08: App [app] with id [7] and pid [68705], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:08: Starting execution sequence in -cluster mode- for app name:app id:7
2016-06-02 15:18:08: App name:app id:7 online
2016-06-02 15:18:12: App name:app id:1 disconnected
2016-06-02 15:18:12: App [app] with id [1] and pid [49526], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:12: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-02 15:18:12: App name:app id:1 online
2016-06-02 15:18:15: App name:app id:11 disconnected
2016-06-02 15:18:15: App [app] with id [11] and pid [50084], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:15: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-02 15:18:15: App name:app id:10 disconnected
2016-06-02 15:18:15: App [app] with id [10] and pid [47454], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:15: Starting execution sequence in -cluster mode- for app name:app id:10
2016-06-02 15:18:16: App name:app id:11 online
2016-06-02 15:18:16: App name:app id:10 online
2016-06-02 15:18:43: App name:app id:8 disconnected
2016-06-02 15:18:43: App [app] with id [8] and pid [49537], exited with code [0] via signal [SIGINT]
2016-06-02 15:18:43: Starting execution sequence in -cluster mode- for app name:app id:8
2016-06-02 15:18:43: App name:app id:8 online
2016-06-02 15:19:02: App name:app id:9 disconnected
2016-06-02 15:19:02: App [app] with id [9] and pid [68716], exited with code [0] via signal [SIGINT]
2016-06-02 15:19:02: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 15:19:02: App name:app id:9 online
2016-06-02 18:14:37: App name:app id:11 disconnected
2016-06-02 18:14:37: App [app] with id [11] and pid [68770], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:37: Starting execution sequence in -cluster mode- for app name:app id:11
2016-06-02 18:14:37: App name:app id:11 online
2016-06-02 18:14:49: App name:app id:5 disconnected
2016-06-02 18:14:49: App [app] with id [5] and pid [68291], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:49: Starting execution sequence in -cluster mode- for app name:app id:5
2016-06-02 18:14:49: App name:app id:1 disconnected
2016-06-02 18:14:49: App [app] with id [1] and pid [68759], exited with code [0] via signal [SIGINT]
2016-06-02 18:14:49: Starting execution sequence in -cluster mode- for app name:app id:1
2016-06-02 18:14:49: App name:app id:5 online
2016-06-02 18:14:50: App name:app id:1 online
2016-06-02 23:16:50: App name:app id:0 disconnected
2016-06-02 23:16:50: App [app] with id [0] and pid [65692], exited with code [0] via signal [SIGINT]
2016-06-02 23:16:50: Starting execution sequence in -cluster mode- for app name:app id:0
2016-06-02 23:16:50: App name:app id:0 online
2016-06-02 23:17:06: App name:app id:3 disconnected
2016-06-02 23:17:06: App [app] with id [3] and pid [48515], exited with code [0] via signal [SIGINT]
2016-06-02 23:17:06: Starting execution sequence in -cluster mode- for app name:app id:3
2016-06-02 23:17:06: App name:app id:3 online
2016-06-02 23:17:06: App name:app id:9 disconnected
2016-06-02 23:17:06: App [app] with id [9] and pid [68830], exited with code [0] via signal [SIGINT]
2016-06-02 23:17:06: Starting execution sequence in -cluster mode- for app name:app id:9
2016-06-02 23:17:06: App name:app id:9 online
2016-06-02 23:17:06: App name:app id:12 disconnected
2016-06-02 23:17:06: App [app] with id [12] and pid [68634], exited with code [0] via signal [SIGINT]
为何一直:exited with code [0] via signal [SIGINT]
ps:机器内存和cpu都很充足
~$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 -v
1.0.0
配置文件:
{
"apps": [
{
"name": "app",
"script": "app.js",
"error_file": "../log/error.log",
"out_file": "../log/access.log",
"merge_logs": true,
"cwd": "./",
"instances": 0,
"exec_mode" : "cluster_mode",
"env": {
"NODE_ENV": "production"
}
}
]
}
请原谅我标题党,求助求助
pm2 stop all --watch
pm2 delete all
pm2 start
pm2 update
机器硬盘空间还有没有? 我之前也遇到过类似问题,当硬盘空间剩余2%左右的时候,pm2就会被杀系统kill掉。
pm2 l
看一下, 是不是开了 watch, 而且监视到 upload 目录了?
@jingsam 直接stop? 然后重新start ? 这样不是照样没效果吗
@captainblue2013 我pm2的版本已经很高了呢: ~$ pm2 -v 1.0.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
硬盘空间很足呢
@wssgcg1213 upload目录是什么呢
诶你这是什么应用 内存如此大.
会不会是内存太大 pm2 自己给你重启了, 是不是开了 max_memory_restart
这个选项
另外试试给 pm2 升一下级
没有设置max_memory_restart
内存还很多呢:
~$ free -m
total used free shared buffers cached
Mem: 16035 8177 7857 0 174 3672
-/+ buffers/cache: 4331 11704
Swap: 0 0 0
我认为很可能是代码里有什么导致了pm2这个行为。 如果是我,我会用排除法,通过不断注释部分代码,预期得到代码中哪个地方导致了这问题。 或者先开一个小的测试代码,看是应用引起的问题,还是外部问题
看下错误日志,另外有没写进程守护代码? From Noder
你是不是在已经启动的情况下,又start一次了?先kill重启吧
@William17 代码那么多,注释查那是多大的工程
@zouzhenxing pm2自动就会守护了,只是经常重启:exited with code [0] via signal [SIGINT]
@ncuzp 没有哦,都没有去动它,过个几个小时 就重启了
你restart 这么多 多半代码有bug 输出重启错误日志
提点一下:用 systemtap, 参考https://sourceware.org/systemtap/ systemtap 脚本如下,找到发送信号的 PID。
#! /usr/bin/env stap
# sigkill.stp
# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# /usr/share/systemtap/tapset/signal.stp:
# [...]
# probe signal.send = _signal.send.*
# {
# sig=$sig
# sig_name = _signal_name($sig)
# sig_pid = task_pid(task)
# pid_name = task_execname(task)
# [...]
probe signal.send {
if (sig_name == "SIGKILL")
printf("%s was sent to %s (pid:%d) by %s uid:%d\n",
sig_name, pid_name, sig_pid, execname(), uid())
}
代码里面有错误吧
最后是代码里面的错误。。