linux 下 CLOSE_WAIT过多的解决方法,如果判定结论是僵尸进程 杀杀杀  杀不死 重启机器 。 不指定

jackxiang 2017-6-24 13:02 | |
结论:僵尸进程 杀杀杀  杀不死 重启机器  
The system is going down for halt NOW!
====================================================

uptime
16:22:19 up 735 days,  5:48,  7 users,  load average: 59.70, 58.29, 54.91
close_wait状态出现的原因是被动关闭方未关闭socket造成
tcp      179      0 127.0.0.1:80                127.0.0.1:4184              CLOSE_WAIT  -                  
tcp      175      0 127.0.0.1:80                127.0.0.1:6038              CLOSE_WAIT  -                  
tcp      177      0 127.0.0.1:80                127.0.0.1:4121              CLOSE_WAIT  -  

netstat -atlunp|grep 80|grep CLOSE_WAIT|wc
3716   26012  405044


----查看当前进程打开了多少句柄数

# lsof -n|awk '{print $2}'|sort|uniq -c|sort -nr|more
162 34255
162 33984
162 33525
162 33356 
........

其中第一列是打开的句柄数,第二列是进程ID。


[root@itv-api_php_bj_syq_10_70_XX_XX www]# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx: nginx: [warn] conflicting server name "common.itv.cntv.cn" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "api.itv.cntv.cn" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "api.itv.cctv.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "newcomment.cntv.cn" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "common.newcomment.cntv.cn" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "newcomment.cctv.com" on 0.0.0.0:80, ignored


strace  -f -p 56014  -p 56015  -p 56016  -p 56017  -p 56018  -p 56019  -p 56020  -p 56021  -p 56022  -p 56023  -p 56024  -p 56025
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
Process 56015 attached - interrupt to quit
Process 56016 attached - interrupt to quit
Process 56017 attached - interrupt to quit
Process 56018 attached - interrupt to quit
Process 56019 attached - interrupt to quit

不是僵尸? 那就是孤儿

http://blog.csdn.net/wesleyluo/article/details/6079139
http://blog.chinaunix.net/uid-10257388-id-2967161.html

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/9272/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]