Skip to content

Commit

Permalink
close socket connection when websocket connect failed to avoid potent…
Browse files Browse the repository at this point in the history
…ial leak (#14038)

* close socket connection when websocket connect failed to avoid potential leak

* add changelog

* fix changelog
  • Loading branch information
ProBrian authored Dec 23, 2024
1 parent 51cb5f1 commit dc1a42d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "Fix potential socket connection leak when websocket client connection fails"
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 @@ -569,6 +569,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

1 comment on commit dc1a42d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:dc1a42dde90b3834bb8051d52d68c45c9a45ac92
Artifacts available https://github.com/Kong/kong/actions/runs/12464204861

Please sign in to comment.