[nginx] svn commit: r5158 - in branches/stable-1.2: . src/http
mdounin at mdounin.ru
mdounin at mdounin.ru
Fri Mar 29 17:34:47 UTC 2013
Author: mdounin
Date: 2013-03-29 17:34:45 +0000 (Fri, 29 Mar 2013)
New Revision: 5158
URL: http://trac.nginx.org/nginx/changeset/5158/nginx
Log:
Merge of r5113, r5114: upstream: resolve errors handling.
Upstream: call ngx_http_run_posted_requests() on resolve errors.
If proxy_pass to a host with dynamic resolution was used to handle
a subrequest, and host resolution failed, the main request wasn't run
till something else happened on the connection. E.g. request to "/zzz"
with the following configuration hanged:
addition_types *;
resolver 8.8.8.8;
location /test {
set $ihost xxx;
proxy_pass http://$ihost;
}
location /zzz {
add_after_body /test;
return 200 "test";
}
Report and original version of the patch by Lanshun Zhou,
http://mailman.nginx.org/pipermail/nginx-devel/2013-March/003476.html.
Modified:
branches/stable-1.2/
branches/stable-1.2/src/http/ngx_http_upstream.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2013-03-29 17:23:36 UTC (rev 5157)
+++ branches/stable-1.2 2013-03-29 17:34:45 UTC (rev 5158)
Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4994,4997,4999-5005,5011-5025,5027-5031,5066,5070-5071,5078,5082-5083,5098,5109,5128
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4994,4997,4999-5005,5011-5025,5027-5031,5066,5070-5071,5078,5082-5083,5098,5109,5113-5114,5128
\ No newline at end of property
Modified: branches/stable-1.2/src/http/ngx_http_upstream.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_upstream.c 2013-03-29 17:23:36 UTC (rev 5157)
+++ branches/stable-1.2/src/http/ngx_http_upstream.c 2013-03-29 17:34:45 UTC (rev 5158)
@@ -865,11 +865,13 @@
static void
ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
{
+ ngx_connection_t *c;
ngx_http_request_t *r;
ngx_http_upstream_t *u;
ngx_http_upstream_resolved_t *ur;
r = ctx->data;
+ c = r->connection;
u = r->upstream;
ur = u->resolved;
@@ -881,7 +883,7 @@
ngx_resolver_strerror(ctx->state));
ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
- return;
+ goto failed;
}
ur->naddrs = ctx->naddrs;
@@ -906,13 +908,17 @@
if (ngx_http_upstream_create_round_robin_peer(r, ur) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
- return;
+ goto failed;
}
ngx_resolve_name_done(ctx);
ur->ctx = NULL;
ngx_http_upstream_connect(r, u);
+
+failed:
+
+ ngx_http_run_posted_requests(c);
}
More information about the nginx-devel
mailing list