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

close socket connection when websocket connect failed to avoid potential leak #14038

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "Fix potential socket connection leak when websocket client connect fails"
ProBrian marked this conversation as resolved.
Show resolved Hide resolved
type: bugfix
scope: Core
1 change: 1 addition & 0 deletions kong/clustering/rpc/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ function _M:connect(premature, node_id, host, path, cert, key)
::err::

if not exiting() then
c:close()
self:try_connect(reconnection_delay)
end
end
Expand Down
1 change: 1 addition & 0 deletions kong/clustering/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function _M.connect_cp(dp, endpoint, protocols)

local ok, err = c:connect(uri, opts)
if not ok then
c:close()
return nil, uri, err
end

Expand Down
Loading