Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#367 closed defect (worksforme)

Nginx / 1.4.1 bus?

Reported by: Toad Zhou Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc:
uname -a: Linux test.com 2.6.32-5-amd64 #1 SMP Fri May 10 08:43:19 UTC 2013 x86_64 GNU/Linux
nginx -V: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-file-aio --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_secure_link_module --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-auth-pam --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-dav-ext-module --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-echo --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-syslog --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-cache-purge --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/ngx_http_pinba_module --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/ngx_http_substitutions_filter_module --add-module=/usr/src/nginx/source/nginx-1.4.1/debian/modules/nginx-x-rid-header --with-ld-opt=-lossp-uuid

Description

Nginx / 1.4.1 set different limit_conn is not effective in multiple locations.

config file:
limit_conn_zone $binary_remote_addr zone=test:10m;
server {

location /a/{

limit_conn test 1;

}

}

Change History (4)

comment:1 by Maxim Dounin, 12 years ago

Resolution: worksforme
Status: newclosed

Works fine here. If you think there is a problem, please provide steps to reproduce the problem.

Note: triggering limit_conn limits with small static files with only one worker process isn't trivial as full request processing happens without going into event loop (unless sending to a client blocks), and thus there are no simultaneously processed requests to limit.

comment:2 by Toad Zhou, 12 years ago

I download the files is very big, and has a speed limit. Is not a small file test.
I don't know if I caused problems with validation. And I in add access_log is abnormal, must be on the outside.
The location in my this is limit_conn and access_log is invalid, but limit_rate is effective.

The following is my configuration files

limit_conn_zone $binary_remote_addr zone=perip:10m;
server
{

listen 8000;
server_name s3.xxx.com;
index index.html index.htm index.php;
root /data0/storage/down/;



location ~ /premium {

secure_link $arg_st,$arg_e;


secure_link_md5 xxxxx$remote_addr$uri$arg_e;

if ($secure_link = "") {

return 403;

}


if ($secure_link = "0") {

return 403;

}


rewrite /premium/files1/(.*)$ /$1;
rewrite
/premium/files2/(.*)$ /user_upload/$1;


limit_conn perip 5;
limit_rate 3000k;

}

location ~ /free {

secure_link $arg_st,$arg_e;


secure_link_md5 xxxx$remote_addr$uri$arg_e;

if ($secure_link = "") {

return 403;

}


if ($secure_link = "0") {

return 403;

}


rewrite /free/files1/(.*)$ /$1;
rewrite
/free/files2/(.*)$ /user_upload/$1;
limit_conn perip 1;
limit_rate 30k;


}

location ~ /registed {

secure_link $arg_st,$arg_e;


secure_link_md5 xxxx$remote_addr$uri$arg_e;

if ($secure_link = "") {

return 403;

}


if ($secure_link = "0") {

return 403;

}


rewrite /registed/files1/(.*)$ /$1;
rewrite
/registed/files2/(.*)$ /user_upload/$1;


limit_conn perip 1;
limit_rate 50k;

}
add_header Content-Disposition 'attachment; filename="$arg_n"';
access_log /tmp/access.log;

}

Last edited 12 years ago by Toad Zhou (previous) (diff)

comment:3 by Toad Zhou, 12 years ago

Tested it is ok, but why can't different location separates the same zone name?
Although successful, such effect and in the server configuration "limit_conn zsf 1" is the same.

Below request is marching at the same time.
ip:8001/zsf/test.zip ok
ip:8001/zsf/test1.zip 503
ip:8001/zsf1/test.zip 503
ip:8001/zsf1/test1.zip 503

limit_conn_zone $binary_remote_addr zone=zsf:10m;

server
{

listen 8001;
index index.html index.htm index.php;
root /tmp/test;

location ~ /zsf {

limit_conn zsf 1;
limit_rate 10k;

}

location ~ /zsf1 {

limit_conn zsf 1;
limit_rate 10k;

}

}

Last edited 12 years ago by Toad Zhou (previous) (diff)

comment:4 by Maxim Dounin, 12 years ago

The "location ~ /zsf1" in your config doesn't make sense as it's never matched, see http://nginx.org/r/location for details. Please use mailing list for further support question.

Note: See TracTickets for help on using tickets.