我无法再运行任何东西(几乎没有任何东西),并且不断收到以下错误消息。如果我执行一个命令,它可能会出现多次错误fork:重试:没有子进程,如果我测试几次,有时它会起作用。
-bash: fork: 重试: 无子进程
-bash: fork: 资源暂时不可用
错误消息示例:
[user@server ~]$ sudo -i
sudo: unable to fork: Resource temporarily unavailable
[user@server ~]$ sudo -i
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: Resource temporarily unavailable
-bash-4.2#
-bash-4.2# logout
[user@server ~]$ sudo -i
[root@server ~]#
[root@server ~]# ps -e --no-headers | wc -l
-bash: fork: retry: No child processes
-bash: fork: retry: Resource temporarily unavailable
86
[root@server ~]# man ulimit
man: fork failed: Resource temporarily unavailable
[root@server ~]# ps -eLF
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: Resource temporarily unavailable
我所能研究的就是无法创建新流程,因为显然已达到流程限制。在我的服务器上,永久运行的进程少于 100 个,线程少于 350 个。
[root@server ~]# ps -e --no-headers | wc -l
86
数据来自htop
:
Tasks: 86, 311 thr; 1 running
Load average: 0.04 0.17 0.16
到目前为止,对我来说限制看起来足够高:
[root@server ~]# prlimit
RESOURCE DESCRIPTION SOFT HARD UNITS
AS address space limit unlimited unlimited bytes
CORE max core file size 0 unlimited blocks
CPU CPU time unlimited unlimited seconds
DATA max data size unlimited unlimited bytes
FSIZE max file size unlimited unlimited blocks
LOCKS max number of file locks held unlimited unlimited
MEMLOCK max locked-in-memory address space 67108864 67108864 bytes
MSGQUEUE max bytes in POSIX mqueues 819200 819200 bytes
NICE max nice prio allowed to raise 0 0
NOFILE max number of open files 1024 4096
NPROC max number of processes 62987 62987
RSS max resident set size unlimited unlimited pages
RTPRIO max real-time priority 0 0
RTTIME timeout for real-time tasks unlimited unlimited microsecs
SIGPENDING max number of pending signals 1029347 1029347
STACK max stack size 8388608 unlimited bytes
[root@server ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1029347
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 62987
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@server ~]# ulimit -aH
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1029347
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 62987
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
我还可以检查什么?
或者说,造成这种不当行为的原因是什么?
服务器是租用的vServer(VPS);提供商的 Virtuozzo 环境中的容器。
服务器运行 CentOS 7.9 并安装了 Plesk;所以它正在运行网络服务器(httpd)、邮件服务器(Postfix、Dovecot)。
是否是 Virtuozzo 环境的问题?如果是这样,我有什么方法可以有效地确定这一点以联系提供商?