Skip to content

Commit

Permalink
fix(healthcheck) fail hard when initial locking_target_list failed
Browse files Browse the repository at this point in the history
Since we didn't protect nil ptr of `targets` in other places in this library, error
on `locking_target_list` which makes `targets` remain `nil` should be considered
unrecoverable failure.

See also Kong/kong#5189
  • Loading branch information
fffonion authored and locao committed Nov 14, 2019
1 parent 38a9802 commit f880430
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/resty/healthcheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,9 @@ function _M.new(opts)
return true
end)
if not ok then
self:log(ERR, "Error loading initial target list: ", err)
-- locking failed, we don't protect `targets` of being nil in other places
-- so consider this as not recoverable
return nil, "Error loading initial target list: " .. err
end

self.ev_callback = function(data, event)
Expand Down

0 comments on commit f880430

Please sign in to comment.