[PATCH 20 of 25] Core: protection from subrequest loops
Maxim Dounin
mdounin at mdounin.ru
Tue Sep 6 15:58:17 UTC 2011
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1315324516 -14400
# Node ID e854e5abda69f3bdee0f87425f9167dc8cd6adca
# Parent 3b75127939ee38809e0847f09de5c139f241053e
Core: protection 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
@@ -2455,7 +2455,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
@@ -1978,6 +1978,7 @@ ngx_http_finalize_request(ngx_http_reque
if (r == c->data) {
r->main->count--;
+ r->main->subrequests++;
if (!r->logged) {
More information about the nginx-devel
mailing list