From 299399231a01db924f228e4e12ae79f822be2e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Thu, 7 Jul 2011 16:54:51 +0800 Subject: [PATCH] applied the subrequest loop fix patch from Maxim Dounin and released ngx_openresty 0.8.54.9rc5. --- patches/nginx-0.8.54-subrequest_loop.patch | 40 ++++++++++++++++++++++ util/mirror-tarballs | 2 ++ util/ver | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 patches/nginx-0.8.54-subrequest_loop.patch diff --git a/patches/nginx-0.8.54-subrequest_loop.patch b/patches/nginx-0.8.54-subrequest_loop.patch new file mode 100644 index 0000000..0b9ca69 --- /dev/null +++ b/patches/nginx-0.8.54-subrequest_loop.patch @@ -0,0 +1,40 @@ +# HG changeset patch +# User Maxim Dounin +# Date 1309187571 -14400 +# Node ID 283a416b2235d5383c12a975edc8866f007fb628 +# Parent f5fc40783ddcbf4db33859ee2a9bce54cf32c350 +Core: protect from subrequest loops. + +Without protection subrequest loop results in r->count overflow and +SIGSEGV. Protection was broken in 0.7.25. + +Note that this also limits number of parallel subrequests. This +wasn't exactly the case before 0.7.25 as local subrequests were +completed directly. + +See here for details: + +http://nginx.org/pipermail/nginx-ru/2010-February/032184.html + +diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c +--- a/src/http/ngx_http_core_module.c ++++ b/src/http/ngx_http_core_module.c +@@ -2287,7 +2287,6 @@ ngx_http_subrequest(ngx_http_request_t * + sr->start_sec = tp->sec; + sr->start_msec = tp->msec; + +- r->main->subrequests++; + r->main->count++; + + *psr = sr; +diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c +--- a/src/http/ngx_http_request.c ++++ b/src/http/ngx_http_request.c +@@ -1981,6 +1981,7 @@ ngx_http_finalize_request(ngx_http_reque + if (r == c->data) { + + r->main->count--; ++ r->main->subrequests++; + + if (!r->logged) { + diff --git a/util/mirror-tarballs b/util/mirror-tarballs index 917f4bb..4e024fb 100755 --- a/util/mirror-tarballs +++ b/util/mirror-tarballs @@ -42,6 +42,8 @@ patch -p1 < $root/patches/nginx-$main_ver-request_body_preread_fix.patch || exit patch -p1 < $root/patches/nginx-$main_ver-request_body_in_single_buf.patch || exit 1 +patch -p1 -l < $root/patches/nginx-$main_ver-subrequest_loop.patch || exit 1 + rm -f *.patch || exit 1 cd .. || exit 1 diff --git a/util/ver b/util/ver index 0a370e4..2987570 100755 --- a/util/ver +++ b/util/ver @@ -1,7 +1,7 @@ #!/bin/bash main_ver=0.8.54 -minor_ver=9rc4 +minor_ver=9rc5 version=$main_ver.$minor_ver echo $version