nginx 反向代理, worker进程挂起 、CPU负载达到100%

68 views
Skip to first unread message

wlong20...@gmail.com

unread,
Nov 13, 2011, 6:31:25 AM11/13/11
to cnginx
截图:http://life.chinaunix.net/bbsfile/
month_1111/1111131826826c0247483ec7a5.jpg

问题|故障现象:
有2个nginx worker进程挂起,CPU负载达到100%,持续很长时间(已经好几天,如果不kill nginx进程,估计会一直持续下去,
即使已经没有用户请求|访问)。
[root@host-22 ~]# ps aux|grep -e nginx -e CPU
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME
COMMAND
root 936 0.0 0.0 49360 7584 ? Ss Nov11 2:30
nginx: master process /usr/local/nginx/sbin/nginx
www 1130 99.9 0.0 55764 13472 ? R Nov11 2590:02
nginx: worker process
www 1216 99.9 0.0 53668 11092 ? R Nov11 2585:57
nginx: worker process
www 29538 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29539 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29540 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29541 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29542 0.0 0.0 50848 9024 ? S 18:25 0:00
nginx: worker process
www 29543 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29544 0.0 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
www 29545 0.3 0.0 50848 8832 ? S 18:25 0:00
nginx: worker process
root 29551 0.0 0.0 61168 812 pts/0 R+ 18:25 0:00 grep -
e nginx -e CPU
[root@host-22 ~]#curl http://127.0.0.1/server_status
Active connections: 647
server accepts handled requests
2088654 2088654 2089763
Reading: 5 Writing: 637 Waiting: 5
上面这个Writing的数字,持续好几天了都不变,即使已经没有用户访问。另外试过strace -p 1130,没有任何输出,这些在截图上也
有。

操作系统环境:
[root@host-22 ~]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-
noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.5 (Final)
Release: 5.5
Codename: Final
[root@host-22 ~]#
[root@host-22 ~]#
[root@host-22 ~]# uname -a
Linux host-22 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64
x86_64 x86_64 GNU/Linux
[root@host-22 ~]#
[root@host-22 ~]#

nginx 版本及编译参数:
[root@host-22 ~]# /usr/local/nginx/sbin/nginx -V
nginx: nginx version: nginx/1.0.4
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
nginx: TLS SNI support disabled
nginx: configure arguments: --user=www --group=www --prefix=/usr/local/
nginx --with-http_stub_status_module --with-http_ssl_module --with-
openssl-opt=enable-tlsext --with-http_sub_module --with-cc-opt=-O2 --
with-cpu-opt=opteron
[root@host-22 ~]#

nginx 反向代理配置:
worker_processes 8;

events {
use epoll;
worker_connections 5120;
}

http {
sendfile on;
keepalive_timeout 15;
...

upstream 2012_servers {
server 10.0.7.5:80 max_fails=2 fail_timeout=30s;
server 10.0.7.6:80 max_fails=2 fail_timeout=30s;
server 10.0.7.7:80 max_fails=2 fail_timeout=30s;
server 10.0.7.8:80 max_fails=2 fail_timeout=30s;
}


server {
listen 80;
server_name test.2012.com ;
...

location / {
include proxy.conf;
proxy_pass http://2012_servers;
}
...

}
很合法的配置呀!真不明白怎么会有nginx worker进程hang住。。。。

wlong20...@gmail.com

unread,
Nov 15, 2011, 9:06:38 PM11/15/11
to cnginx
找到原因了。
http://forum.nginx.org/read.php?2,218259 官方论坛帖 (结论)

Raiden

unread,
Nov 17, 2011, 10:36:21 PM11/17/11
to cng...@googlegroups.com
good

在 2011年11月16日 上午10:06,wlong20...@gmail.com <wlong20...@gmail.com>写道:
找到原因了。
http://forum.nginx.org/read.php?2,218259   官方论坛帖 (结论)

--
您收到此邮件是因为您订阅了 Google 网上论坛的“cnginx”论坛。
要向此网上论坛发帖,请发送电子邮件至 cng...@googlegroups.com
要取消订阅此网上论坛,请发送电子邮件至 cnginx+un...@googlegroups.com
若有更多问题,请通过 http://groups.google.com/group/cnginx?hl=zh-CN 访问此网上论坛。




--

Raiden Xu

Madhouse Inc.
China's most intelligent mobile ad network

T: +86 21 51600278 ext 6209  F: +86 21 61289599  M: +86 138 1604 5692
706 Cloud Nine Plaza, No.1118 West Yanan Road, Shanghai 200052, China


Reply all
Reply to author
Forward
0 new messages