# HG changeset patch # User Ruslan Ermilov # Date 1356533166 0 # Node ID 82336a9ce26d340c145e5c8c47c41a1f6d5b9e77 # Parent 5d1d3b2acb1d724d051295a4707391d55b19ce46 Upstream keepalive: detect duplicate "keepalive" directive. A failure to detect duplicate "keepalive" directive resulted in stack exhaustion. diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c --- a/src/http/modules/ngx_http_upstream_keepalive_module.c +++ b/src/http/modules/ngx_http_upstream_keepalive_module.c @@ -502,6 +502,10 @@ ngx_http_upstream_keepalive(ngx_conf_t * kcf = ngx_http_conf_upstream_srv_conf(uscf, ngx_http_upstream_keepalive_module); + if (kcf->original_init_upstream) { + return "is duplicate"; + } + kcf->original_init_upstream = uscf->peer.init_upstream ? uscf->peer.init_upstream : ngx_http_upstream_init_round_robin;