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

The targets is nil when call the function get_target after add target. #43

Closed
dabue opened this issue Apr 27, 2020 · 0 comments · Fixed by #58
Closed

The targets is nil when call the function get_target after add target. #43

dabue opened this issue Apr 27, 2020 · 0 comments · Fixed by #58

Comments

@dabue
Copy link

dabue commented Apr 27, 2020

At v1.2.0 , some errors got like:
[error] 46#46: 14188959 failed to run balancer_by_lua: /opt/app/test_proj/deps/share/lua/5.1/resty/healthcheck.lua:247: attempt to index field 'targets' (a nil value)
stack traceback:
/opt/app/test_proj/deps/share/lua/5.1/resty/healthcheck.lua:247: in function 'get_target'
/opt/app/test_proj/deps/share/lua/5.1/resty/healthcheck.lua:424: in function 'get_target_status'
/opt/app/test_proj/lua/ins_breaker/http/balancer.lua:334: in function 'load_balancer'
/opt/app/test_proj/lua/circuit_breaker.lua:259: in function 'http_balancer_phase'
balancer_by_lua:2: in main chunk while connecting to upstream, client: 10.23.178.7

Using the function locking_target_list, the timer delays adding targets, so it will get an error if use the get_target_status function to get the status of a node before added.
I wanna add a wait_add_target_list to store the target before added to the target_list actually, and to store target's default is_healthy status.

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