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

fix: prevents memory accumulation from informers #5627

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

shawkins
Copy link
Contributor

@shawkins shawkins commented Dec 1, 2023

Description

I completely missed the need for cleanup with the proactive closing of informers with #5327. Unfortunately this affects both implicit and explicit usage of informers. An alternative approach is to track if the client has been closed - I had initially avoided that because it's more work, as you can see from this pr. This approach though doesn't have much risk other than some code complexity.

The only other possibility would be to track a set of informers on the BaseClient and close them using the completablefuture, but that will also require actively removing entires from the set once they've already been closed.

Fixes #5626

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@shawkins
Copy link
Contributor Author

shawkins commented Dec 1, 2023

Correction - closing the client doesn't seem to have enough of a proactive effect for the ResourceTest test to pass. The next update to the commit adds the explicit tracking of closeables to the BaseClient. For now I've left in the HttpClient close tracking as well, but it could be removed if desired.

Copy link

sonarqubecloud bot commented Dec 2, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

58.5% 58.5% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@manusa manusa added this to the 6.10.0 milestone Dec 4, 2023
@manusa manusa merged commit 7fe6d52 into fabric8io:main Dec 4, 2023
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory Leak in Kubernetes Client
4 participants