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.
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 leaks with metadata processors #16349
Fix leaks with metadata processors #16349
Changes from all commits
f454c5f
a2a191b
7653391
5714239
27c5063
b7e9d1d
ab008f6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also wait for the cache shutdown/Close to be 'completed'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that for this processor it is ok not to wait, it only needs to stop a goroutine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I missed it, but does the watcher use the case? If so, does this Stop here block until the watcher is done before we continue closing the cache?
Instead of channels consider to use context.Context for cancellation. Grouping tasks and waiting for completion can be done e.g. via
unison.TaskGroup
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, the watcher actually uses the cache. But I don't think this is a problem by now, the cache can be used even after being stopped, it only doesn't clean expired entries.
Changing the watcher to use context cancellation instead of Start/Stop will require some refactors.
I will give a try to improve this, let me know if you don't consider it so blocking 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was wrong, the informer used by
add_kuberentes_metadata
has a cache, but is a different one, the cache stopped here is not used by the watcher.