Skip to content

Commit f880430

Browse files
fffonionlocao
authored andcommitted
fix(healthcheck) fail hard when initial locking_target_list failed
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
1 parent 38a9802 commit f880430

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/resty/healthcheck.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,9 @@ function _M.new(opts)
13241324
return true
13251325
end)
13261326
if not ok then
1327-
self:log(ERR, "Error loading initial target list: ", err)
1327+
-- locking failed, we don't protect `targets` of being nil in other places
1328+
-- so consider this as not recoverable
1329+
return nil, "Error loading initial target list: " .. err
13281330
end
13291331

13301332
self.ev_callback = function(data, event)

0 commit comments

Comments
 (0)