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

bug: failed to run balancer_by_lua*: /usr/local/share/lua/5.1/resty/healthcheck.lua:247: attempt to index field 'targets' (a nil value) #3537

Closed
kuberxy opened this issue Feb 6, 2021 · 6 comments
Labels
checking check first if this issue occurred

Comments

@kuberxy
Copy link

kuberxy commented Feb 6, 2021

Issue description

2021/02/05 14:24:48 [error] 17384#17384: 114551120 failed to run balancer_by_lua: /usr/local/share/lua/5.1/resty/healthcheck.lua:247: attempt to index field 'targets' (a nil value)
stack traceback:
/usr/local/share/lua/5.1/resty/healthcheck.lua:247: in function 'get_target'
/usr/local/share/lua/5.1/resty/healthcheck.lua:424: in function 'get_target_status'
/usr/local/share/lua/5.1/apisix/balancer.lua:68: in function 'fetch_health_nodes'
/usr/local/share/lua/5.1/apisix/balancer.lua:149: in function 'create_obj_fun'
/usr/local/share/lua/5.1/apisix/core/lrucache.lua:92: in function 'lrucache_server_picker'
/usr/local/share/lua/5.1/apisix/balancer.lua:246: in function 'pick_server'
/usr/local/share/lua/5.1/apisix/balancer.lua:276: in function 'load_balancer'
/usr/local/share/lua/5.1/apisix/init.lua:748: in function 'http_balancer_phase'
balancer_by_lua:2: in main chunk while connecting to upstream, client: 183.95.49.7, server: , request:

Environment

  • apisix version (cmd: apisix version): 2.1
  • OS (cmd: uname -a): 4.15.0-111-generic Ubuntu 18.04
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):openresty/1.15.8.3
@kuberxy
Copy link
Author

kuberxy commented Feb 6, 2021

@membphis
Copy link
Member

membphis commented Feb 6, 2021

Have you tried the latest version? you are using 2.1 version

@membphis membphis added the checking check first if this issue occurred label Feb 6, 2021
@kuberxy
Copy link
Author

kuberxy commented Feb 6, 2021

I did not use the latest version

@spacewander
Copy link
Member

Should be fixed by #3240

@panhow
Copy link

panhow commented Dec 24, 2021

@spacewander hello , wonder why #3240 can fix this issue ?

@membphis
Copy link
Member

the healthcheck will call resty-lock, and the resty-lock will call ngx.sleep, but ngx.sleep can not be called in balancer phase.

so we move it to access phase which allow to call ngx.sleep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checking check first if this issue occurred
Projects
None yet
Development

No branches or pull requests

4 participants