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(clustering/rpc): more strict parameter checking when generating a RPC error #12951

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kong/clustering/rpc/json_rpc_v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function _M.new_error(id, code, msg)
id = id,
error = {
code = code,
message = msg,
message = tostring(msg),
ADD-SP marked this conversation as resolved.
Show resolved Hide resolved
ADD-SP marked this conversation as resolved.
Show resolved Hide resolved
}
}
end
Expand Down
3 changes: 2 additions & 1 deletion kong/clustering/rpc/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local constants = require("kong.constants")


local assert = assert
local unpack = unpack
local string_format = string.format
local kong = kong
local is_timeout = utils.is_timeout
Expand Down Expand Up @@ -68,7 +69,7 @@ function _M._dispatch(premature, self, cb, payload)
ngx_log(ngx_WARN, "[rpc] RPC callback failed: ", err)

res, err = self.outgoing:push(new_error(payload.id, jsonrpc.SERVER_ERROR,
tostring(err)))
err))
if not res then
ngx_log(ngx_WARN, "[rpc] unable to push RPC call error: ", err)
end
Expand Down