fix(core): explicitly close httpc socket to prevent file descriptor leak in PAUSE loop#1466
Open
varun-ai69 wants to merge 3 commits into
Open
fix(core): explicitly close httpc socket to prevent file descriptor leak in PAUSE loop#1466varun-ai69 wants to merge 3 commits into
varun-ai69 wants to merge 3 commits into
Conversation
…eak in PAUSE loop Signed-off-by: varun-ai69 <kushwahavarun86@gmail.com>
varun-ai69
requested review from
chaitanyaenr,
ddjain,
paigerube14 and
tsebastiani
as code owners
July 10, 2026 19:09
Contributor
There was a problem hiding this comment.
Risk Analysis 🛡️ · Low Risk
✅ Approved — Low-Risk Change
Details
Purely additive one-line resource cleanup: adds httpc.close() after response.read() in server.get_status(), on the successful return path. Fixes the FD leak in the PAUSE polling loop described in the PR body / issue #1463. HTTPConnection.close() on a fully-read response is a standard-library-safe call. Diff is confined to server.py; no opted-out paths, schemas, auth, infra, or observable behavior change.
… on network failure Signed-off-by: varun-ai69 <kushwahavarun86@gmail.com>
… test to check connection closes even when request() raises Signed-off-by: varun-ai69 <kushwahavarun86@gmail.com>
Contributor
Author
|
hey @paigerube14 @ddjain @tsebastiani @chaitanyaenr can you please review the pr whenever you are freee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
When Kraken is running in
PAUSEstate (e.g.,signal_state: PAUSEwith a short polling interval), theserver.get_status()method is called continuously to poll the server. Previously, it opened a newHTTPConnectionon every check but never explicitly closed it.This resulted in a critical TCP socket resource leak inside the OS where the garbage collector could not keep up, eventually causing the system to crash with an
OSError: [Errno 24] Too many open files(or[WinError 10048]on Windows).This PR fixes the issue by explicitly adding
httpc.close()before the function returns inserver.get_status(), safely destroying the socket and keeping the file descriptor count flat during long wait loops.Related Tickets & Documents
If no related issue, please create one and start the converasation on wants of
Documentation
Related Documentation PR (if applicable)
Checklist before requesting a review
See testing your changes and run on any Kubernetes or OpenShift cluster to validate your changes
REQUIRED:
Description of combination of tests performed and output of run