Skip to content

Commit

Permalink
fix(wrpc) do a pcall for all export_deflated_reconfigure_payload calls
Browse files Browse the repository at this point in the history
We are already wrapping some calls to
`export_deflated_reconfigure_payload()` inside a pcall in the
`wrpc_control_plane.lua` file. This change is doing a pcall in all the
remaining calls to `export_deflated_reconfigure_payload()` in this file
to avoid the CP crash whenever we find errors during initialization of
modules for example.
  • Loading branch information
gruceo authored and kikito committed Apr 22, 2022
1 parent 3c89fa1 commit 612648c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kong/clustering/wrpc_control_plane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ end

function _M:push_config_one_client(client)
if not self.config_call_rpc or not self.config_call_args then
local payload, err = self:export_deflated_reconfigure_payload()
if not payload then
local ok, err = pcall(self.export_deflated_reconfigure_payload, self)
if not ok then
ngx_log(ngx_ERR, _log_prefix, "unable to export config from database: ", err)
return
end
Expand Down Expand Up @@ -558,8 +558,8 @@ local function push_config_loop(premature, self, push_config_semaphore, delay)
end

do
local _, err = self:export_deflated_reconfigure_payload()
if err then
local ok, err = pcall(self.export_deflated_reconfigure_payload, self)
if not ok then
ngx_log(ngx_ERR, _log_prefix, "unable to export initial config from database: ", err)
end
end
Expand Down

0 comments on commit 612648c

Please sign in to comment.