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

Memory leak caused by HealthCheckHandler function #190

Closed
khangtna opened this issue Nov 5, 2024 · 3 comments · Fixed by #191
Closed

Memory leak caused by HealthCheckHandler function #190

khangtna opened this issue Nov 5, 2024 · 3 comments · Fixed by #191
Labels
bug Something isn't working

Comments

@khangtna
Copy link

khangtna commented Nov 5, 2024

Hi @kimdre,

When I deployed and handled a high volume of commits to git within a time frame, I noticed that the agent memory usage increased abnormally.

Screenshot 2024-11-05 at 21 38 53

`
After checking the code, I found that the HealthCheckHandler() function includes a segment that checks the Docker socket connection via the VerifySocketConnection() function. In this function, the httpClient instance is created but not closed after use.

httpClient := NewHttpClient()

When I added code to ensure the httpClient is released after use.

defer httpClient.CloseIdleConnections()

httpClient := NewHttpClient()

err = VerifySocketRead(httpClient, apiVersion)
if err != nil {
  return err
}

defer httpClient.CloseIdleConnections() //close http client

It worked. Memory usage is now stable, with no further unexpected increases.
Please check this again.

@kimdre kimdre added the bug Something isn't working label Nov 5, 2024
kimdre added a commit that referenced this issue Nov 5, 2024

Verified

This commit was signed with the committer’s verified signature.
kimdre Kim Oliver Drechsel
@kimdre kimdre linked a pull request Nov 5, 2024 that will close this issue
@kimdre
Copy link
Owner

kimdre commented Nov 5, 2024

Thank you for noticing this. :)

kimdre added a commit that referenced this issue Nov 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* fix(#190): memory leak caused by HealthCheckHandler function

* chore: update module github.com/docker/cli to v27.3.2-0.20241008150905-cb3048fbebb1+incompatible
@kimdre
Copy link
Owner

kimdre commented Nov 5, 2024

The fix is released with v0.12.2

@khangtna
Copy link
Author

khangtna commented Nov 6, 2024

You're welcome. Thanks for your app, it's a great gitops CD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants