Opened 12 years ago
Closed 12 years ago
#202 closed defect (worksforme)
a nginx moudle bug
Reported by: | Qi Luo | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | nginx-module | Version: | |
Keywords: | Cc: | ||
uname -a: | Linux ovear 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/0.8.55
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-52) TLS SNI support disabled configure arguments: --user=nobody --group=nobody --add-module=../ngx_cache_purge-1.5 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module |
Description
if you install HttpRealipModule with nginx, when you use "proxy_pass" and download a big file, (Whether you use HttpRealipModule) it will take a lot of cpu,and nginx will not response
form nginx 0.8x to nginx1.2x have the same problem.
Change History (6)
follow-up: 2 comment:1 by , 12 years ago
follow-up: 3 comment:2 by , 12 years ago
Replying to Ruslan Ermilov:
Can you reproduce the problem without 3rd party modules?
If yes, can you provide an example configuration enough to reproduce the problem?
yeah,sometime it will produce(take a lot of cpu),and wait about 3 minutes,it will be normal
this is the config
nginx.conf
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
events {
use epoll;
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$host"';
server {
listen 9998;
server_name _;
location /
{
proxy_pass http://127.0.0.1;
include proxy.conf;
}
location ~ /status {
stub_status on;
access_log off;
}
}
}
realip.conf
set $my_x_real_ip "";
if ($http_x_real_ip ~ "$") {
set $my_x_real_ip $remote_addr;
}
if ($my_x_real_ip ~ "$") {
set $my_x_real_ip $http_x_real_ip;
}
proxy.conf
include realip.conf;
proxy_connect_timeout 30s;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 32k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding ;
proxy_set_header Host $host;
proxy_set_header Referer $http_referer;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $my_x_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
follow-up: 4 comment:3 by , 12 years ago
Replying to Qi Luo <ovearj@gmail.com>:
The ngx_http_realip_module
doesn't have any effect unless you specify which client addresses it should do its job for by the means of the set_real_ip_from
directives. The config you've provided doesn't have any traces of these directives.
comment:4 by , 12 years ago
Replying to Ruslan Ermilov:
Replying to Qi Luo <ovearj@gmail.com>:
The
ngx_http_realip_module
doesn't have any effect unless you specify which client addresses it should do its job for by the means of theset_real_ip_from
directives. The config you've provided doesn't have any traces of these directives.
i delete that command brfore i post the config
i just use realip.conf instead of
set_real_ip_from 113.0.1.1;
real_ip_header X-Real-IP;
comment:5 by , 12 years ago
Please provide:
- Output of the "nginx -V" command. Please make sure nginx is recent enough (i.e. 1.2.3 or better 1.3.5) and doesn't contain any 3rd party modules/patches.
- Full config to reproduce the problem. That is, full minimal configuration file you are able to reproduce the problem with. Please remove any configuration directives not needed to reproduce the problem. Please also make sure you are able to reproduce the problem with the exact config posted and please provide steps you've used to reproduce the problem.
- Backtrace of the nginx process hogging CPU. You may attach to a running process with "gdb /path/to/nginx <pid>", then use "backtrace full" command to obtain a backtrace, and "next" / "step" commands to walk though code to find out where it loops. Post your investigation results and/or gdb session transcript here.
- Debug log of a problem.
Please see http://wiki.nginx.org/Debugging for some additional details. Please also make sure hardware problems are ruled out (e.g. you are able to reproduce the problem on another host).
Can you reproduce the problem without 3rd party modules?
If yes, can you provide an example configuration enough to reproduce the problem?