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

Conversation

ProBrian
Copy link
Contributor

@ProBrian ProBrian commented Dec 19, 2024

For websocket client, we should close socket connection by websocket.client.close() when there's error on websocket.client.connect, because connect failure will leave an occupied socket. We should not rely on GC to release the socket connection.

Summary

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix https://konghq.atlassian.net/browse/KAG-5361

@github-actions github-actions bot added core/clustering cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Dec 19, 2024
@chobits chobits self-requested a review December 20, 2024 07:53
@@ -0,0 +1,3 @@
message: "Fix potential socket connection leak when websocket client connection fails"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
message: "Fix potential socket connection leak when websocket client connection fails"
message: "Fixed potential connection leaks when the data plane failed to connect to the control plane.

@kikito kikito merged commit dc1a42d into master Dec 23, 2024
26 checks passed
@kikito kikito deleted the chore/ws_close branch December 23, 2024 09:05
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

@ADD-SP
Copy link
Contributor

ADD-SP commented Dec 31, 2024

Manually cherry-pick: https://github.com/Kong/kong-ee/pull/11031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/clustering size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants