comparison src/http/ngx_http_upstream.c @ 4115:70a45a504905

Workaround for cpu hog on errors with cached connections. Just doing another connect isn't safe as peer.get() may expect peer.tries to be strictly positive (this is the case e.g. with round robin with multiple upstream servers). Increment peer.tries to at least avoid cpu hog in round robin balancer (with the patch alert will be seen instead). This is not enough to fully address the problem though, hence TODO. We should be able to inform balancer that the error wasn't considered fatal and it may make sense to retry the same peer.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 15 Sep 2011 18:12:58 +0000
parents 5db098f97e0e
children 9baf12ea5ca1
comparison
equal deleted inserted replaced
4114:5db098f97e0e 4115:70a45a504905
2810 } 2810 }
2811 2811
2812 if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) { 2812 if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) {
2813 status = 0; 2813 status = 0;
2814 2814
2815 /* TODO: inform balancer instead */
2816
2817 u->peer.tries++;
2818
2815 } else { 2819 } else {
2816 switch(ft_type) { 2820 switch(ft_type) {
2817 2821
2818 case NGX_HTTP_UPSTREAM_FT_TIMEOUT: 2822 case NGX_HTTP_UPSTREAM_FT_TIMEOUT:
2819 status = NGX_HTTP_GATEWAY_TIME_OUT; 2823 status = NGX_HTTP_GATEWAY_TIME_OUT;