Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_primary_peers doesn't return name #31

Open
r--w opened this issue Jul 19, 2016 · 4 comments
Open

get_primary_peers doesn't return name #31

r--w opened this issue Jul 19, 2016 · 4 comments

Comments

@r--w
Copy link

r--w commented Jul 19, 2016

Hello, it seems that when "zone" is defined the name filed is returned only for the first peer.

nginx version:
./nginx -v nginx version: openresty/1.9.15.1

upstreams.conf:

upstream http_local {
zone local_zone 64k;
server 127.0.0.1:80 ;
server 127.0.0.2:80 ;
keepalive 16;
}

access.lua:

log(ERR, cjson.encode(upstream.get_primary_peers(upstream_name)))
log(ERR, cjson.encode(upstream.get_servers(upstream_name)))

log.txt:

016/07/19 13:50:00 [error] 80976#0: *92 [lua] access.lua:91: [{"weight":1,"id":0,"conns":0,"fails":0,"current_weight":0,"fail_timeout":10,"effective_weight":1,"name":"127.0.0.1:80","max_fails":1},{"weight":0,"id":1,"conns":0,"fails":0,"current_weight":0,"down":true,"effective_weight":0,"fail_timeout":12,"checked":1.4057793776513e+14,"name":"","max_fails":16}], client: 127.0.0.1, server: _, request: "GET /index.php HTTP/1.1", host: "xxxxx"

2016/07/19 13:50:00 [error] 80976#0: *92 [lua] access.lua:92: [{"addr":"127.0.0.1:80","weight":1,"fail_timeout":10,"name":"127.0.0.1:80","max_fails":1},{"addr":"127.0.0.2:80","weight":1,"fail_timeout":10,"name":"127.0.0.2:80","max_fails":1}], client: 127.0.0.1, server: _, request: "GET /index.php HTTP/1.1", host: "xxxxx"

As you can see in the first log, the second "name " field is empty. If "zone" definition is removed than the result is ok. In contrast the upstream.get_servers method returns always good results.

This issue affects https://github.com/openresty/lua-resty-upstream-healthcheck

@agentzh
Copy link
Member

agentzh commented Jul 19, 2016

@r--w Right, the zone directive of the nginx core is relatively new and has not yet supported in this module. Are you willing to contribute a patch for it to speed up the support? Thanks!

@r--w
Copy link
Author

r--w commented Jul 22, 2016

I understand, seems that enabling "zone" parameter also couses segmentation faults in workers. Unfortunatelly I don't have requirered C/nginx skills to fix that. I simply stopped using this parameter.

@quezacoatl
Copy link

@agentzh Possible to get any pointers on how to fix this issue? I have looked in the code, but have a hard time finding the parsing of upstreams.

@thefab
Copy link

thefab commented May 13, 2019

+1
=> I got some segmentation faults when using "zone" parameter in an upstream with this module

'seems to be fixed with #67 (in my use case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants