【原创】内存不足导致 nginx 崩溃的原因分析

最近在 Centos7 上搭建 nginx 作为 web 服务器使用,但是使用过程中,nginx 总是莫名其妙的崩掉,使用命令 dmesg 检查错误信息如下:

[6655217.659132] Out of memory: Kill process 11494 (lsof) score 10 or sacrifice child
[6655217.659567] Killed process 11494 (lsof) total-vm:161160kB, anon-rss:42368kB, file-rss:0kB, shmem-rss:0kB

使用命令 cat /var/log/nginx/error.log 来查看 nginx 的错误日志包含如下信息:

2017/10/26 22:59:45 [crit] 13093#0: accept4() failed (23: Too many open files in system)
2017/10/26 22:59:45 [crit] 13092#0: accept4() failed (23: Too many open files in system)

经过高人指点,是系统配置设置没法满足当前的使用量,准确点说是系统的 open files (打开文件数目)配置的太低了。

使用命令 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) 15089
max loc
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值