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

fix(balancer) avoid crash when failing to obtain list of upstreams #4301

Merged
merged 1 commit into from
Feb 12, 2019

Conversation

hishamhm
Copy link
Contributor

@hishamhm hishamhm commented Feb 12, 2019

Avoid a stacktrace when the database fails to obtain the list of upstreams (as
seen in an error log provided by @hutchic): instead report a CRIT-level
message and fallback to an empty list.

2019/02/12 17:38:18 [crit] 36#0: *7 [lua] balancer.lua:719: init(): failed loading initial list of upstreams: failed to get from node cache: callback threw an error: /usr/local/share/lua/5.1/kong/runloop/balancer.lua:476: attempt to index local 'up' (a
boolean value)
stack traceback:
       /usr/local/share/lua/5.1/kong/runloop/balancer.lua:476: in function </usr/local/share/lua/5.1/kong/runloop/balancer.lua:472>
       [C]: in function 'xpcall'
       /usr/local/share/lua/5.1/resty/mlcache.lua:766: in function 'get'
       /usr/local/share/lua/5.1/kong/cache.lua:126: in function 'get'
       /usr/local/share/lua/5.1/kong/runloop/balancer.lua:489: in function 'get_all_upstreams'
       /usr/local/share/lua/5.1/kong/runloop/balancer.lua:717: in function 'init'
       /usr/local/share/lua/5.1/kong/runloop/handler.lua:565: in function </usr/local/share/lua/5.1/kong/runloop/handler.lua:564>, context: ngx.timer

@hishamhm hishamhm force-pushed the fix/error-handling-upstreams branch from a929241 to cadf0ff Compare February 12, 2019 21:16
Avoid a stacktrace when the database fails to obtain the list of upstreams (as
seen in an error log provided by @hutchic): instead report a CRIT-level
message and fallback to an empty list.
@hishamhm hishamhm force-pushed the fix/error-handling-upstreams branch from cadf0ff to f5e09b1 Compare February 12, 2019 21:53
@hishamhm hishamhm merged commit c59787e into master Feb 12, 2019
@hishamhm hishamhm deleted the fix/error-handling-upstreams branch February 12, 2019 22:28
@hishamhm hishamhm added this to the 1.0.4 milestone Feb 14, 2019
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

Successfully merging this pull request may close these issues.

2 participants