mirror of
https://github.com/nginx/nginx.git
synced 2024-12-13 11:09:06 +08:00
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.
This commit is contained in:
parent
d7c2673d3f
commit
c42c70f478
@ -2812,6 +2812,10 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) {
|
if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) {
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
||||||
|
/* TODO: inform balancer instead */
|
||||||
|
|
||||||
|
u->peer.tries++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switch(ft_type) {
|
switch(ft_type) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user