nginx worker process hang,cpu load 100%

Long Wan nginx-forum at nginx.us
Sun Nov 13 12:06:02 UTC 2011


Hi, 
I have faced a trouble with nginx runs as a http revers proxy server,the
worker process sometimes hanging there, cpu usage up to 100%,it's never
recovey until i kill the process,below is the detail informations: 

system environment:
[root at 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 at host-22 ~]# 
[root at 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



nginx version:
[root at 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 at host-22 ~]# 
(also tested under 1.0.6 and 1.0.9,have the same problem)


nginx config( nginx runs as a http revers proxy server):
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;
        }
...

}



trouble:
[root at host-22 ~]# ps aux|grep -e CPU -e nginx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
COMMAND
root       936  0.0  0.0  49328  7572 ?        Ss   Nov11   2:37 nginx:
master process /usr/local/nginx/sbin/nginx
www       1130 99.9  0.0  55764 13472 ?        R    Nov11 2664:28 nginx:
worker process      
www       1216 99.9  0.0  53668 11092 ?        R    Nov11 2660:23 nginx:
worker process      
www      31057  0.0  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31058  0.0  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31059  0.0  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31060  0.0  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31061  0.0  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31062  0.8  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      
www      31063  0.1  0.0  50816  9012 ?        S    19:40   0:00 nginx:
worker process      
www      31064  0.2  0.0  50816  8820 ?        S    19:40   0:00 nginx:
worker process      

two nginx worker processes(pid 1130,1216) are hanging. there is nothing
significant message i can found in error.log or strace (-p 1130|1216).

Grateful for any advice.

thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,218259,218259#msg-218259



More information about the nginx mailing list