2019独角兽企业重金招聘Python工程师标准>>>
运行写的不太完善的爬虫程序, 未限制任务队列大小, 再加上本子配置不高, 爬取网站到第3层大半时, 内存不足了...
进程运行太猛, 导致系统 out of memory, 那么此进程被系统的oom killer杀死.
此时终端显示 "Killed" 或 "已杀死".
查看相关信息的命令:
dmesg | egrep -i -B100 'killed process' 或: egrep -i 'killed process' /var/log/messages egrep -i -r 'killed process' /var/log 或: journalctl -xb | egrep -i 'killed process'
结果类似这样:
4月 07 10:48:58 arch kernel: Out of memory: Kill process 1245 (python) score 685 or sacrifice child 4月 07 10:48:58 arch kernel: Killed process 1245 (python) total-vm:3519016kB, anon-rss:2453976kB, file-rss:0kB
参考:
http://stackoverflow.com/questions/726690/who-killed-my-process-and-why
http://stackoverflow.com/questions/624857/finding-which-process-was-killed-by-linux-oom-killer
http://unix.stackexchange.com/questions/10077/where-can-i-see-a-list-of-kernel-killed-processes
Linux 查看进程被杀死的详情