openresty icon indicating copy to clipboard operation
openresty copied to clipboard

balancer.set_more_tries(count) not work in openresty 1.15.8.2

Open lijiaocn opened this issue 7 years ago • 5 comments

I find the problem when use kubernetes/ingress-nginx 0.25.0. If socket addr is not reachable, ingress-nginx will print a lot of error log.

You can reproduce it with config:

stream{
        upstream upstream_balancer{
                server 0.0.0.1:1234; # placeholder
                balancer_by_lua_block {
                   local ngx_balancer = require("ngx.balancer")
                   ngx_balancer.set_more_tries(1)
                   local ok, err = ngx_balancer.set_current_peer("127.0.0.1","8080")
                   if not ok then
                      ngx.log(ngx.ERR, string.format("error while setting current upstream : %s", err))
                   end
                }
        }
        server {
                proxy_timeout          600s;
                listen                       127.0.0.1:12346;
                proxy_pass              upstream_balancer;
        }
}

If 127.0.0.1:8080 is not reachable, you will get a lot of error log:

图片

If change "ngx_balancer.set_more_tries(1)" to "ngx_balancer.set_more_tries(0)", openresty won't retry, there will be one line error log, conflicting with set_more_tries's definition.

As i know, 1.15.8.1, 1.15.8.2 has the problem, 1.13.x doesn't.

lijiaocn avatar Sep 17 '19 08:09 lijiaocn

I have read 1545 and 1546, it should be ingress-nginx's bug, proxy_next_upstream_tries is not set.

lijiaocn avatar Sep 17 '19 09:09 lijiaocn

I have read 1545 and 1546, it should be ingress-nginx's bug, proxy_next_upstream_tries is not set.

Didi you solve this problem? I have set proxy_next_upstream_tries to 3, but it dosen't work.

PU-101 avatar Jun 11 '20 07:06 PU-101

I set the same with you,but not work ,Did you solve this problem? @PU-101

nnntlh avatar Oct 17 '20 04:10 nnntlh

@PU-101 @nnntlh You can check out the documentation and the test suite for working examples. If still in doubt, please provide a minimal and standalone example that we can easily reproduce the problem on our side. Thank you! Also, hijacking a closed issue is not a good idea BTW. The original issue is clearly solved already.

agentzh avatar Oct 18 '20 00:10 agentzh

https://github.com/kubernetes/ingress-nginx/issues/5425 found , aws(elb) or aliyun(slb) always check tcp port,so I expose tcp port without ingress (openresty), I use svc+slb,this can solve my problem

nnntlh avatar Oct 22 '20 05:10 nnntlh