所有命令都导致无法分配内存:fork: Cannot allocate memory
All commands results in cannot allocate memory: fork: Cannot allocate memory
我正在使用 AWS EC2
,我的 EC2
配置是 4GB RAM
和 100GB
存储。但是我的服务器在每个命令 fork: Cannot allocate memory
几天后显示以下错误。当我使用 df
命令时,它显示如下输出:
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 41M 355M 11% /run
/dev/xvda1 97G 8.1G 89G 9% /
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 87M 87M 0 100% /snap/core/5145
/dev/loop1 13M 13M 0 100% /snap/amazon-ssm-agent/295
/dev/loop2 88M 88M 0 100% /snap/core/5328
/dev/loop3 13M 13M 0 100% /snap/amazon-ssm-agent/495
/dev/loop4 17M 17M 0 100% /snap/amazon-ssm-agent/734
tmpfs 396M 0 396M 0% /run/user/1000
我们设置了每隔一分钟一次的 cron 以将数据存储在 MongoDB 中。
在这个错误 fork: Cannot allocate memory
之后,我的 MongoDB 崩溃了。下面显示的是这个原因我收到错误吗?
/dev/loop0 87M 87M 0 100% /snap/core/5145
/dev/loop1 13M 13M 0 100% /snap/amazon-ssm-agent/295
/dev/loop2 88M 88M 0 100% /snap/core/5328
/dev/loop3 13M 13M 0 100% /snap/amazon-ssm-agent/495
/dev/loop4 17M 17M 0 100% /snap/amazon-ssm-agent/734
还是其他什么原因?请建议我如何解决此问题。
已更新
命令ps aux --sort -rss
输出如下图
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 14746 0.1 1.2 605972 50864 ? Sl Sep25 2:48 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 16371 0.1 1.2 603916 50752 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 1253 0.1 1.2 605972 50744 ? Sl Sep25 1:56 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21904 0.2 1.2 603912 50732 ? Sl Sep24 5:20 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25045 0.1 1.2 605976 50692 ? Sl Sep25 2:42 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 4465 0.1 1.2 573212 50688 ? Sl Sep25 1:51 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 26414 0.1 1.2 605972 50644 ? Sl Sep25 2:55 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 31119 0.1 1.2 603912 50620 ? Sl Sep25 1:50 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 30843 0.1 1.2 605972 50596 ? Sl Sep25 2:33 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 6931 0.1 1.2 603912 50472 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 27885 0.1 1.2 603908 50292 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 14980 0.2 1.2 603912 50280 ? Sl Sep25 3:27 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 16793 0.1 1.2 605972 50232 ? Sl Sep25 2:03 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 31385 0.1 1.2 605976 49992 ? Sl Sep25 2:09 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 13127 0.1 1.2 605972 49536 ? Sl Sep25 1:51 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 30413 0.1 1.2 605980 49292 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 3978 0.1 1.2 605972 49176 ? Sl Sep25 2:29 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 22464 0.1 1.2 603912 49048 ? Sl Sep25 2:00 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21049 0.1 1.2 603912 48708 ? Sl Sep25 3:01 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 20409 0.2 1.2 605972 48580 ? Sl Sep24 4:32 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 19526 0.2 1.1 603912 48364 ? Sl Sep25 3:41 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21797 0.2 1.1 605980 48032 ? Sl Sep24 4:07 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25980 0.2 1.1 573200 47596 ? Sl Sep25 3:34 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25180 0.2 0.6 382020 25888 ? Sl Sep24 4:21 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16764 0.2 0.6 857164 25616 ? Sl Sep24 7:08 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3910 0.1 0.6 453324 25528 ? Sl Sep25 3:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29769 0.1 0.6 439884 25396 ? Sl Sep25 2:30 /usr/bin/python3 /home/folder_name/test.py
ubuntu 14702 0.1 0.6 443968 25376 ? Sl Sep25 2:29 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22640 0.1 0.6 446268 25284 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10698 0.1 0.6 439284 24908 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7118 0.1 0.6 382108 24856 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20857 0.1 0.6 381968 24852 ? Sl Sep25 2:31 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9652 0.1 0.6 382320 24820 ? Sl Sep25 2:17 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25578 0.1 0.6 381984 24804 ? Sl Sep25 2:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29743 0.1 0.6 382040 24772 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31964 0.1 0.6 382024 24772 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 802 0.1 0.6 382060 24752 ? Sl Sep25 2:57 /usr/bin/python3 /home/folder_name/test.py
ubuntu 23609 0.1 0.6 382000 24752 ? Sl Sep25 2:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 2425 0.1 0.6 382060 24740 ? Sl Sep25 1:33 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22551 0.1 0.6 381984 24740 ? Sl Sep25 2:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11631 0.1 0.6 382060 24732 ? Sl Sep25 3:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 12422 0.2 0.6 382068 24720 ? Sl Sep24 5:29 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6878 0.1 0.6 382056 24712 ? Sl Sep25 2:26 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1296 0.1 0.6 382160 24704 ? Sl Sep25 1:59 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30729 0.1 0.6 382360 24700 ? Sl Sep25 1:56 /usr/bin/python3 /home/folder_name/test.py
ubuntu 4985 0.1 0.6 382064 24692 ? Sl Sep25 3:25 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9017 0.1 0.6 382048 24688 ? Sl Sep25 2:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1885 0.1 0.6 382040 24680 ? Sl Sep25 1:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3065 0.1 0.6 382016 24672 ? Sl Sep25 1:57 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15708 0.1 0.6 382320 24672 ? Sl Sep25 1:58 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6603 0.1 0.6 381968 24668 ? Sl Sep25 3:20 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9581 0.2 0.6 455704 24664 ? Sl Sep24 5:36 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16056 0.1 0.6 382024 24648 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24948 0.1 0.6 381984 24644 ? Sl Sep25 3:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10836 0.1 0.6 382104 24640 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 2865 0.1 0.6 381968 24632 ? Sl Sep25 2:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3622 0.1 0.6 382024 24632 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25284 0.1 0.6 381988 24628 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 18324 0.2 0.6 382060 24620 ? Sl Sep24 4:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 14285 0.1 0.6 381976 24616 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29572 0.1 0.6 382064 24576 ? Sl Sep25 1:54 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32483 0.1 0.6 381924 24576 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6141 0.1 0.6 382296 24552 ? Sl Sep25 2:22 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31282 0.1 0.6 381972 24552 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 17592 0.1 0.6 382088 24528 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10968 0.1 0.6 382024 24520 ? Sl Sep25 2:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20984 0.1 0.6 382060 24500 ? Sl Sep25 1:42 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20978 0.1 0.6 381988 24496 ? Sl Sep25 3:19 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24415 0.1 0.6 381972 24492 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5606 0.1 0.6 390164 24480 ? Sl Sep25 3:33 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8889 0.1 0.6 381972 24480 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15768 0.1 0.6 381972 24452 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5896 0.1 0.6 381972 24448 ? Sl Sep25 1:31 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9024 0.1 0.6 382244 24444 ? Sl Sep25 1:50 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5381 0.1 0.6 381972 24408 ? Sl Sep25 1:49 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32471 0.1 0.6 382056 24400 ? Sl Sep25 1:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31974 0.1 0.6 382092 24352 ? Sl Sep25 1:59 /usr/bin/python3 /home/folder_name/test.py
ubuntu 603 0.1 0.6 382056 24348 ? Sl Sep25 1:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 19188 0.1 0.5 382056 24224 ? Sl Sep25 1:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15824 0.2 0.5 381968 24200 ? Sl Sep24 5:30 /usr/bin/python3 /home/folder_name/test.py
ubuntu 27547 0.1 0.5 382280 24096 ? Sl Sep25 2:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25498 0.1 0.5 382036 23956 ? Sl Sep25 2:08 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8147 0.2 0.5 381984 23848 ? Sl Sep24 5:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1407 0.2 0.5 382060 23796 ? Sl Sep24 4:49 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30229 0.1 0.5 381992 23756 ? Sl Sep25 2:00 /usr/bin/python3 /home/folder_name/test.py
ubuntu 17822 0.1 0.5 381980 23648 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21288 0.1 0.5 390256 23592 ? Sl Sep25 2:25 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7836 0.2 0.5 455804 23560 ? Sl Sep24 5:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24801 0.2 0.5 382048 23532 ? Sl Sep24 5:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11738 0.1 0.5 382036 23504 ? Sl Sep25 2:09 /usr/bin/python3 /home/folder_name/test.py
ubuntu 28161 0.1 0.5 446404 23484 ? Sl Sep25 2:17 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3304 0.1 0.5 381988 23464 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 12358 0.1 0.5 382060 23344 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21739 0.1 0.5 382060 23332 ? Sl Sep25 3:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9802 0.2 0.5 381980 23228 ? Sl Sep24 4:23 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25083 0.1 0.5 382096 23100 ? Sl Sep25 1:42 /usr/bin/python3 /home/folder_name/test.py
ubuntu 27147 0.1 0.5 382056 23060 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21416 0.1 0.5 445172 23040 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22407 0.1 0.5 447428 23028 ? Sl Sep25 2:37 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16342 0.1 0.5 382060 23008 ? Sl Sep25 2:14 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7718 0.1 0.5 382004 22972 ? Sl Sep25 2:36 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30414 0.1 0.5 381968 22888 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24367 0.2 0.5 382000 22736 ? Sl Sep24 4:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32043 0.1 0.5 382060 22600 ? Sl Sep24 3:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 23225 0.1 0.5 382028 22584 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20706 0.1 0.5 382060 22520 ? Sl Sep25 1:55 /usr/bin/python3 /home/folder_name/test.py
ubuntu 13525 0.1 0.5 381968 22492 ? Sl Sep25 2:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8609 0.1 0.5 381984 22420 ? Sl Sep25 2:24 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5340 0.1 0.5 382024 22320 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1534 0.1 0.5 382056 22300 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6618 0.1 0.5 455796 22228 ? Sl Sep24 3:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8983 0.2 0.5 382044 22188 ? Sl Sep24 4:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6528 0.2 0.5 382060 22128 ? Sl Sep24 4:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20981 0.2 0.5 382064 22020 ? Sl Sep24 4:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24469 0.1 0.5 381984 22020 ? Sl Sep25 3:32 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22106 0.1 0.5 382028 21976 ? Sl Sep25 2:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11596 0.2 0.5 381968 21804 ? Sl Sep24 4:37 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16412 0.1 0.5 382044 21624 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 19820 0.1 0.5 434772 21552 ? Sl Sep25 2:36 /usr/bin/python3 /home/folder_name/test.py
root 15557 0.0 0.4 239840 19284 ? Ssl Sep04 23:19 /usr/lib/snapd/snapd
postgres 29110 0.0 0.3 293436 14704 ? S Sep19 0:10 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
root 18090 0.1 0.2 308512 8636 ? Ssl Sep20 14:22 /snap/amazon-ssm-agent/734/amazon-ssm-agent
root 378 0.0 0.1 40736 7504 ? Ss Sep04 0:44 /lib/systemd/systemd-journald
root 5092 0.0 0.1 94892 6948 ? Ss 06:03 0:00 sshd: ubuntu [priv]
root 22334 0.0 0.1 94888 6936 ? Ss 06:38 0:00 sshd: ubuntu [priv]
root 11520 0.0 0.1 94888 6856 ? Ss 05:11 0:00 sshd: ubuntu [priv]
root 1126 0.0 0.1 272944 5568 ? Ssl Sep04 1:06 /usr/lib/accountsservice/accounts-daemon
ubuntu 5150 0.0 0.1 21480 5236 pts/0 Ss 06:03 0:00 -bash
root 1 0.0 0.1 37776 5048 ? Ss Sep04 0:43 /sbin/init
ubuntu 11534 0.0 0.1 45144 4584 ? Ss 05:11 0:00 /lib/systemd/systemd --user
root 1088 0.0 0.0 833712 4044 ? Ssl Sep04 0:15 /usr/bin/lxcfs /var/lib/lxcfs/
postgres 29113 0.0 0.0 293436 3952 ? Ss Sep19 0:11 postgres: writer process
ubuntu 24451 0.0 0.0 36580 3840 pts/0 R+ 06:42 0:00 ps aux --sort -rss
root 19311 0.0 0.0 5720 3512 ? S<Ls Sep24 0:15 /sbin/iscsid
root 1184 0.0 0.0 280628 3504 ? Ssl Sep04 0:00 /usr/lib/policykit-1/polkitd --no-debug
postgres 29115 0.0 0.0 293820 3444 ? Ss Sep19 0:17 postgres: autovacuum launcher process
ubuntu 5143 0.0 0.0 94892 3388 ? S 06:03 0:00 sshd: ubuntu@pts/0
postgres 29112 0.0 0.0 293436 3328 ? Ss Sep19 0:00 postgres: checkpointer process
ubuntu 11562 0.0 0.0 94888 3324 ? S 05:11 0:00 sshd: ubuntu
ubuntu 22369 0.0 0.0 94888 3324 ? S 06:38 0:00 sshd: ubuntu
root 1252 0.0 0.0 65508 3128 ? Ss Sep04 0:05 /usr/sbin/sshd -D
root 1079 0.0 0.0 28988 3048 ? Ss Sep04 0:03 /lib/systemd/systemd-logind
www-data 23982 0.0 0.0 125444 3008 ? S Sep24 0:17 nginx: worker process
root 454 0.0 0.0 43760 2860 ? Ss Sep04 0:02 /lib/systemd/systemd-udevd
root 17433 0.0 0.0 125116 2668 ? Ss Sep24 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
postgres 29114 0.0 0.0 293436 2660 ? Ss Sep19 0:11 postgres: wal writer process
root 888 0.0 0.0 16116 2648 ? Ss Sep04 0:01 /sbin/dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
syslog 1070 0.0 0.0 260628 2412 ? Ssl Sep04 0:17 /usr/sbin/rsyslogd -n
root 1062 0.0 0.0 26068 2008 ? Ss Sep04 0:21 /usr/sbin/cron -f
root 601 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1250 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1294 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1531 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1883 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 2863 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3063 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3301 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3620 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3976 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5338 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5379 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5603 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6139 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6526 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 6616 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 6875 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6927 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7116 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7698 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7834 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 8058 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 8607 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8733 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8885 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8981 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 9015 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 9579 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 9800 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 10634 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 10834 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11594 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 11629 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11735 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11975 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 12420 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 13125 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 13523 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14283 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14698 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14976 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 15766 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 15822 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 16340 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16369 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16410 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16762 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 16791 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 17820 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 18322 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 19185 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 19523 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20405 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 20704 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20855 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20979 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 20982 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21047 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21286 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21414 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21795 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 22104 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22401 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22455 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22638 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 23223 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 23606 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24365 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 24413 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24467 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24799 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 24946 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25043 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25178 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 25282 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25496 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25576 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25942 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 26412 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 27145 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 27882 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 29751 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30227 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30409 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30410 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30726 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31109 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31280 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31383 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31962 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31972 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 32041 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 32469 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16053 0.0 0.0 49372 1964 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30840 0.0 0.0 49372 1964 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14742 0.0 0.0 49372 1960 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21899 0.0 0.0 49372 1960 ? S Sep24 0:00 /usr/sbin/CRON -f
root 4981 0.0 0.0 49372 1952 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6600 0.0 0.0 49372 1948 ? S Sep25 0:00 /usr/sbin/CRON -f
ubuntu 11536 0.0 0.0 63320 1944 ? S 05:11 0:00 (sd-pam)
root 10966 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 17512 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 28158 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 9626 0.0 0.0 49372 1876 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21599 0.0 0.0 49372 1852 ? S Sep25 0:00 /usr/sbin/CRON -f
root 32261 0.0 0.0 49372 1844 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20753 0.0 0.0 49372 1840 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25038 0.0 0.0 49372 1836 ? S Sep25 0:00 /usr/sbin/CRON -f
www-data 23981 0.0 0.0 125444 1780 ? S Sep24 0:26 nginx: worker process
root 15570 0.0 0.0 49372 1776 ? S Sep25 0:00 /usr/sbin/CRON -f
postgres 29116 0.0 0.0 148420 1776 ? Ss Sep19 0:06 postgres: stats collector process
之前我们没有安装nginx服务器,直接使用crontab -e
。在主目录中,我们创建了一个文件夹,在该文件夹中,我们创建了两个文件并设置了 crons 和 crontab -e
命令显示了这个
# m h dom mon dow command
*/10 * * * * /usr/bin/python3 /home/folder_name/m2.py
*/3 * * * * /usr/bin/python3 /home/folder_name/test.py
首先/dev/loop*
是挂载snapd服务使用的磁盘映像的虚拟设备,它们处于100%是完全正常的,因为它们是只读的。
错误 fork: Cannot allocate memory
表示您的服务器正在交换(运行 可用内存不足)。我不确定您为什么要查看 df
输出,但这不是与磁盘 space 相关的问题,除非您正在寻找与交换分区相关的解决方案,但我想这里不是这种情况。
您提到“我的服务器在几天后显示错误”,这似乎是某处发生内存泄漏的症状。
如果我是你,我会首先找出是什么占用了所有内存。您可以 运行 以下命令按内存使用对进程进行排序:
ps aux --sort -rss
您还可以使用 top
或 htop
进行实时调试。
对于您的 reference,mongodb (wiredTiger) 默认使用 RAM 的 60% 减去 1GB 或 1GB 中较大的一个。
一旦找出罪魁祸首,您要么想修复它,要么接受需要更多 RAM 的事实。如果是后一种情况,您可能需要将实例升级到 8GB RAM 甚至更多。
我正在使用 AWS EC2
,我的 EC2
配置是 4GB RAM
和 100GB
存储。但是我的服务器在每个命令 fork: Cannot allocate memory
几天后显示以下错误。当我使用 df
命令时,它显示如下输出:
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 41M 355M 11% /run
/dev/xvda1 97G 8.1G 89G 9% /
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 87M 87M 0 100% /snap/core/5145
/dev/loop1 13M 13M 0 100% /snap/amazon-ssm-agent/295
/dev/loop2 88M 88M 0 100% /snap/core/5328
/dev/loop3 13M 13M 0 100% /snap/amazon-ssm-agent/495
/dev/loop4 17M 17M 0 100% /snap/amazon-ssm-agent/734
tmpfs 396M 0 396M 0% /run/user/1000
我们设置了每隔一分钟一次的 cron 以将数据存储在 MongoDB 中。
在这个错误 fork: Cannot allocate memory
之后,我的 MongoDB 崩溃了。下面显示的是这个原因我收到错误吗?
/dev/loop0 87M 87M 0 100% /snap/core/5145
/dev/loop1 13M 13M 0 100% /snap/amazon-ssm-agent/295
/dev/loop2 88M 88M 0 100% /snap/core/5328
/dev/loop3 13M 13M 0 100% /snap/amazon-ssm-agent/495
/dev/loop4 17M 17M 0 100% /snap/amazon-ssm-agent/734
还是其他什么原因?请建议我如何解决此问题。
已更新
命令ps aux --sort -rss
输出如下图
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 14746 0.1 1.2 605972 50864 ? Sl Sep25 2:48 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 16371 0.1 1.2 603916 50752 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 1253 0.1 1.2 605972 50744 ? Sl Sep25 1:56 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21904 0.2 1.2 603912 50732 ? Sl Sep24 5:20 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25045 0.1 1.2 605976 50692 ? Sl Sep25 2:42 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 4465 0.1 1.2 573212 50688 ? Sl Sep25 1:51 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 26414 0.1 1.2 605972 50644 ? Sl Sep25 2:55 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 31119 0.1 1.2 603912 50620 ? Sl Sep25 1:50 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 30843 0.1 1.2 605972 50596 ? Sl Sep25 2:33 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 6931 0.1 1.2 603912 50472 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 27885 0.1 1.2 603908 50292 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 14980 0.2 1.2 603912 50280 ? Sl Sep25 3:27 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 16793 0.1 1.2 605972 50232 ? Sl Sep25 2:03 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 31385 0.1 1.2 605976 49992 ? Sl Sep25 2:09 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 13127 0.1 1.2 605972 49536 ? Sl Sep25 1:51 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 30413 0.1 1.2 605980 49292 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 3978 0.1 1.2 605972 49176 ? Sl Sep25 2:29 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 22464 0.1 1.2 603912 49048 ? Sl Sep25 2:00 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21049 0.1 1.2 603912 48708 ? Sl Sep25 3:01 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 20409 0.2 1.2 605972 48580 ? Sl Sep24 4:32 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 19526 0.2 1.1 603912 48364 ? Sl Sep25 3:41 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 21797 0.2 1.1 605980 48032 ? Sl Sep24 4:07 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25980 0.2 1.1 573200 47596 ? Sl Sep25 3:34 /usr/bin/python3 /home/folder_name/m2.py
ubuntu 25180 0.2 0.6 382020 25888 ? Sl Sep24 4:21 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16764 0.2 0.6 857164 25616 ? Sl Sep24 7:08 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3910 0.1 0.6 453324 25528 ? Sl Sep25 3:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29769 0.1 0.6 439884 25396 ? Sl Sep25 2:30 /usr/bin/python3 /home/folder_name/test.py
ubuntu 14702 0.1 0.6 443968 25376 ? Sl Sep25 2:29 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22640 0.1 0.6 446268 25284 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10698 0.1 0.6 439284 24908 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7118 0.1 0.6 382108 24856 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20857 0.1 0.6 381968 24852 ? Sl Sep25 2:31 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9652 0.1 0.6 382320 24820 ? Sl Sep25 2:17 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25578 0.1 0.6 381984 24804 ? Sl Sep25 2:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29743 0.1 0.6 382040 24772 ? Sl Sep25 1:39 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31964 0.1 0.6 382024 24772 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 802 0.1 0.6 382060 24752 ? Sl Sep25 2:57 /usr/bin/python3 /home/folder_name/test.py
ubuntu 23609 0.1 0.6 382000 24752 ? Sl Sep25 2:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 2425 0.1 0.6 382060 24740 ? Sl Sep25 1:33 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22551 0.1 0.6 381984 24740 ? Sl Sep25 2:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11631 0.1 0.6 382060 24732 ? Sl Sep25 3:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 12422 0.2 0.6 382068 24720 ? Sl Sep24 5:29 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6878 0.1 0.6 382056 24712 ? Sl Sep25 2:26 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1296 0.1 0.6 382160 24704 ? Sl Sep25 1:59 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30729 0.1 0.6 382360 24700 ? Sl Sep25 1:56 /usr/bin/python3 /home/folder_name/test.py
ubuntu 4985 0.1 0.6 382064 24692 ? Sl Sep25 3:25 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9017 0.1 0.6 382048 24688 ? Sl Sep25 2:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1885 0.1 0.6 382040 24680 ? Sl Sep25 1:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3065 0.1 0.6 382016 24672 ? Sl Sep25 1:57 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15708 0.1 0.6 382320 24672 ? Sl Sep25 1:58 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6603 0.1 0.6 381968 24668 ? Sl Sep25 3:20 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9581 0.2 0.6 455704 24664 ? Sl Sep24 5:36 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16056 0.1 0.6 382024 24648 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24948 0.1 0.6 381984 24644 ? Sl Sep25 3:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10836 0.1 0.6 382104 24640 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 2865 0.1 0.6 381968 24632 ? Sl Sep25 2:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3622 0.1 0.6 382024 24632 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25284 0.1 0.6 381988 24628 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 18324 0.2 0.6 382060 24620 ? Sl Sep24 4:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 14285 0.1 0.6 381976 24616 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 29572 0.1 0.6 382064 24576 ? Sl Sep25 1:54 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32483 0.1 0.6 381924 24576 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6141 0.1 0.6 382296 24552 ? Sl Sep25 2:22 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31282 0.1 0.6 381972 24552 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 17592 0.1 0.6 382088 24528 ? Sl Sep25 1:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 10968 0.1 0.6 382024 24520 ? Sl Sep25 2:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20984 0.1 0.6 382060 24500 ? Sl Sep25 1:42 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20978 0.1 0.6 381988 24496 ? Sl Sep25 3:19 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24415 0.1 0.6 381972 24492 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5606 0.1 0.6 390164 24480 ? Sl Sep25 3:33 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8889 0.1 0.6 381972 24480 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15768 0.1 0.6 381972 24452 ? Sl Sep25 1:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5896 0.1 0.6 381972 24448 ? Sl Sep25 1:31 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9024 0.1 0.6 382244 24444 ? Sl Sep25 1:50 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5381 0.1 0.6 381972 24408 ? Sl Sep25 1:49 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32471 0.1 0.6 382056 24400 ? Sl Sep25 1:52 /usr/bin/python3 /home/folder_name/test.py
ubuntu 31974 0.1 0.6 382092 24352 ? Sl Sep25 1:59 /usr/bin/python3 /home/folder_name/test.py
ubuntu 603 0.1 0.6 382056 24348 ? Sl Sep25 1:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 19188 0.1 0.5 382056 24224 ? Sl Sep25 1:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 15824 0.2 0.5 381968 24200 ? Sl Sep24 5:30 /usr/bin/python3 /home/folder_name/test.py
ubuntu 27547 0.1 0.5 382280 24096 ? Sl Sep25 2:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25498 0.1 0.5 382036 23956 ? Sl Sep25 2:08 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8147 0.2 0.5 381984 23848 ? Sl Sep24 5:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1407 0.2 0.5 382060 23796 ? Sl Sep24 4:49 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30229 0.1 0.5 381992 23756 ? Sl Sep25 2:00 /usr/bin/python3 /home/folder_name/test.py
ubuntu 17822 0.1 0.5 381980 23648 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21288 0.1 0.5 390256 23592 ? Sl Sep25 2:25 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7836 0.2 0.5 455804 23560 ? Sl Sep24 5:35 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24801 0.2 0.5 382048 23532 ? Sl Sep24 5:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11738 0.1 0.5 382036 23504 ? Sl Sep25 2:09 /usr/bin/python3 /home/folder_name/test.py
ubuntu 28161 0.1 0.5 446404 23484 ? Sl Sep25 2:17 /usr/bin/python3 /home/folder_name/test.py
ubuntu 3304 0.1 0.5 381988 23464 ? Sl Sep25 1:45 /usr/bin/python3 /home/folder_name/test.py
ubuntu 12358 0.1 0.5 382060 23344 ? Sl Sep25 2:41 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21739 0.1 0.5 382060 23332 ? Sl Sep25 3:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 9802 0.2 0.5 381980 23228 ? Sl Sep24 4:23 /usr/bin/python3 /home/folder_name/test.py
ubuntu 25083 0.1 0.5 382096 23100 ? Sl Sep25 1:42 /usr/bin/python3 /home/folder_name/test.py
ubuntu 27147 0.1 0.5 382056 23060 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/test.py
ubuntu 21416 0.1 0.5 445172 23040 ? Sl Sep25 1:47 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22407 0.1 0.5 447428 23028 ? Sl Sep25 2:37 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16342 0.1 0.5 382060 23008 ? Sl Sep25 2:14 /usr/bin/python3 /home/folder_name/test.py
ubuntu 7718 0.1 0.5 382004 22972 ? Sl Sep25 2:36 /usr/bin/python3 /home/folder_name/test.py
ubuntu 30414 0.1 0.5 381968 22888 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24367 0.2 0.5 382000 22736 ? Sl Sep24 4:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 32043 0.1 0.5 382060 22600 ? Sl Sep24 3:43 /usr/bin/python3 /home/folder_name/test.py
ubuntu 23225 0.1 0.5 382028 22584 ? Sl Sep25 1:48 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20706 0.1 0.5 382060 22520 ? Sl Sep25 1:55 /usr/bin/python3 /home/folder_name/test.py
ubuntu 13525 0.1 0.5 381968 22492 ? Sl Sep25 2:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8609 0.1 0.5 381984 22420 ? Sl Sep25 2:24 /usr/bin/python3 /home/folder_name/test.py
ubuntu 5340 0.1 0.5 382024 22320 ? Sl Sep25 1:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 1534 0.1 0.5 382056 22300 ? Sl Sep25 1:44 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6618 0.1 0.5 455796 22228 ? Sl Sep24 3:38 /usr/bin/python3 /home/folder_name/test.py
ubuntu 8983 0.2 0.5 382044 22188 ? Sl Sep24 4:06 /usr/bin/python3 /home/folder_name/test.py
ubuntu 6528 0.2 0.5 382060 22128 ? Sl Sep24 4:46 /usr/bin/python3 /home/folder_name/test.py
ubuntu 20981 0.2 0.5 382064 22020 ? Sl Sep24 4:10 /usr/bin/python3 /home/folder_name/test.py
ubuntu 24469 0.1 0.5 381984 22020 ? Sl Sep25 3:32 /usr/bin/python3 /home/folder_name/test.py
ubuntu 22106 0.1 0.5 382028 21976 ? Sl Sep25 2:02 /usr/bin/python3 /home/folder_name/test.py
ubuntu 11596 0.2 0.5 381968 21804 ? Sl Sep24 4:37 /usr/bin/python3 /home/folder_name/test.py
ubuntu 16412 0.1 0.5 382044 21624 ? Sl Sep25 2:34 /usr/bin/python3 /home/folder_name/test.py
ubuntu 19820 0.1 0.5 434772 21552 ? Sl Sep25 2:36 /usr/bin/python3 /home/folder_name/test.py
root 15557 0.0 0.4 239840 19284 ? Ssl Sep04 23:19 /usr/lib/snapd/snapd
postgres 29110 0.0 0.3 293436 14704 ? S Sep19 0:10 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
root 18090 0.1 0.2 308512 8636 ? Ssl Sep20 14:22 /snap/amazon-ssm-agent/734/amazon-ssm-agent
root 378 0.0 0.1 40736 7504 ? Ss Sep04 0:44 /lib/systemd/systemd-journald
root 5092 0.0 0.1 94892 6948 ? Ss 06:03 0:00 sshd: ubuntu [priv]
root 22334 0.0 0.1 94888 6936 ? Ss 06:38 0:00 sshd: ubuntu [priv]
root 11520 0.0 0.1 94888 6856 ? Ss 05:11 0:00 sshd: ubuntu [priv]
root 1126 0.0 0.1 272944 5568 ? Ssl Sep04 1:06 /usr/lib/accountsservice/accounts-daemon
ubuntu 5150 0.0 0.1 21480 5236 pts/0 Ss 06:03 0:00 -bash
root 1 0.0 0.1 37776 5048 ? Ss Sep04 0:43 /sbin/init
ubuntu 11534 0.0 0.1 45144 4584 ? Ss 05:11 0:00 /lib/systemd/systemd --user
root 1088 0.0 0.0 833712 4044 ? Ssl Sep04 0:15 /usr/bin/lxcfs /var/lib/lxcfs/
postgres 29113 0.0 0.0 293436 3952 ? Ss Sep19 0:11 postgres: writer process
ubuntu 24451 0.0 0.0 36580 3840 pts/0 R+ 06:42 0:00 ps aux --sort -rss
root 19311 0.0 0.0 5720 3512 ? S<Ls Sep24 0:15 /sbin/iscsid
root 1184 0.0 0.0 280628 3504 ? Ssl Sep04 0:00 /usr/lib/policykit-1/polkitd --no-debug
postgres 29115 0.0 0.0 293820 3444 ? Ss Sep19 0:17 postgres: autovacuum launcher process
ubuntu 5143 0.0 0.0 94892 3388 ? S 06:03 0:00 sshd: ubuntu@pts/0
postgres 29112 0.0 0.0 293436 3328 ? Ss Sep19 0:00 postgres: checkpointer process
ubuntu 11562 0.0 0.0 94888 3324 ? S 05:11 0:00 sshd: ubuntu
ubuntu 22369 0.0 0.0 94888 3324 ? S 06:38 0:00 sshd: ubuntu
root 1252 0.0 0.0 65508 3128 ? Ss Sep04 0:05 /usr/sbin/sshd -D
root 1079 0.0 0.0 28988 3048 ? Ss Sep04 0:03 /lib/systemd/systemd-logind
www-data 23982 0.0 0.0 125444 3008 ? S Sep24 0:17 nginx: worker process
root 454 0.0 0.0 43760 2860 ? Ss Sep04 0:02 /lib/systemd/systemd-udevd
root 17433 0.0 0.0 125116 2668 ? Ss Sep24 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
postgres 29114 0.0 0.0 293436 2660 ? Ss Sep19 0:11 postgres: wal writer process
root 888 0.0 0.0 16116 2648 ? Ss Sep04 0:01 /sbin/dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
syslog 1070 0.0 0.0 260628 2412 ? Ssl Sep04 0:17 /usr/sbin/rsyslogd -n
root 1062 0.0 0.0 26068 2008 ? Ss Sep04 0:21 /usr/sbin/cron -f
root 601 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1250 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1294 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1531 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 1883 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 2863 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3063 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3301 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3620 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 3976 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5338 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5379 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 5603 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6139 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6526 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 6616 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 6875 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6927 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7116 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7698 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 7834 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 8058 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 8607 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8733 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8885 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 8981 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 9015 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 9579 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 9800 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 10634 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 10834 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11594 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 11629 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11735 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 11975 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 12420 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 13125 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 13523 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14283 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14698 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14976 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 15766 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 15822 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 16340 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16369 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16410 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16762 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 16791 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 17820 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 18322 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 19185 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 19523 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20405 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 20704 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20855 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20979 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 20982 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21047 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21286 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21414 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21795 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 22104 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22401 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22455 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 22638 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 23223 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 23606 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24365 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 24413 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24467 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 24799 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 24946 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25043 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25178 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 25282 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25496 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25576 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25942 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 26412 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 27145 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 27882 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 29751 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30227 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30409 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30410 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30726 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31109 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31280 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31383 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31962 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 31972 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 32041 0.0 0.0 49372 1972 ? S Sep24 0:00 /usr/sbin/CRON -f
root 32469 0.0 0.0 49372 1972 ? S Sep25 0:00 /usr/sbin/CRON -f
root 16053 0.0 0.0 49372 1964 ? S Sep25 0:00 /usr/sbin/CRON -f
root 30840 0.0 0.0 49372 1964 ? S Sep25 0:00 /usr/sbin/CRON -f
root 14742 0.0 0.0 49372 1960 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21899 0.0 0.0 49372 1960 ? S Sep24 0:00 /usr/sbin/CRON -f
root 4981 0.0 0.0 49372 1952 ? S Sep25 0:00 /usr/sbin/CRON -f
root 6600 0.0 0.0 49372 1948 ? S Sep25 0:00 /usr/sbin/CRON -f
ubuntu 11536 0.0 0.0 63320 1944 ? S 05:11 0:00 (sd-pam)
root 10966 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 17512 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 28158 0.0 0.0 49372 1888 ? S Sep25 0:00 /usr/sbin/CRON -f
root 9626 0.0 0.0 49372 1876 ? S Sep25 0:00 /usr/sbin/CRON -f
root 21599 0.0 0.0 49372 1852 ? S Sep25 0:00 /usr/sbin/CRON -f
root 32261 0.0 0.0 49372 1844 ? S Sep25 0:00 /usr/sbin/CRON -f
root 20753 0.0 0.0 49372 1840 ? S Sep25 0:00 /usr/sbin/CRON -f
root 25038 0.0 0.0 49372 1836 ? S Sep25 0:00 /usr/sbin/CRON -f
www-data 23981 0.0 0.0 125444 1780 ? S Sep24 0:26 nginx: worker process
root 15570 0.0 0.0 49372 1776 ? S Sep25 0:00 /usr/sbin/CRON -f
postgres 29116 0.0 0.0 148420 1776 ? Ss Sep19 0:06 postgres: stats collector process
之前我们没有安装nginx服务器,直接使用crontab -e
。在主目录中,我们创建了一个文件夹,在该文件夹中,我们创建了两个文件并设置了 crons 和 crontab -e
命令显示了这个
# m h dom mon dow command
*/10 * * * * /usr/bin/python3 /home/folder_name/m2.py
*/3 * * * * /usr/bin/python3 /home/folder_name/test.py
首先/dev/loop*
是挂载snapd服务使用的磁盘映像的虚拟设备,它们处于100%是完全正常的,因为它们是只读的。
错误 fork: Cannot allocate memory
表示您的服务器正在交换(运行 可用内存不足)。我不确定您为什么要查看 df
输出,但这不是与磁盘 space 相关的问题,除非您正在寻找与交换分区相关的解决方案,但我想这里不是这种情况。
您提到“我的服务器在几天后显示错误”,这似乎是某处发生内存泄漏的症状。
如果我是你,我会首先找出是什么占用了所有内存。您可以 运行 以下命令按内存使用对进程进行排序:
ps aux --sort -rss
您还可以使用 top
或 htop
进行实时调试。
对于您的 reference,mongodb (wiredTiger) 默认使用 RAM 的 60% 减去 1GB 或 1GB 中较大的一个。
一旦找出罪魁祸首,您要么想修复它,要么接受需要更多 RAM 的事实。如果是后一种情况,您可能需要将实例升级到 8GB RAM 甚至更多。