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 deadlocks and memory leaks from the watcher/watchDispatcher implementation. #129

Merged
merged 5 commits into from
Aug 20, 2024

Conversation

ttimonen
Copy link
Contributor

There's relatively verbose analysis in the comments on why the watch.Interface is
quite convoluted to implement in a way that doesn't deadlock. In particular adhering to both the Hyrum's law version
of the API, and the documented version of the API is highly impractical.

Also simplify the testing implementation and add test-cases for the deadlocks.

Possibly controversal part: The context lifetime propagation in the Watch() call. The API expectation on that is not obvious.

The changes are probably easiest to read one commit at a time, since they are quite self-contained.

ttimonen added 3 commits July 24, 2024 17:25
This is a prequel refactoring that helps to lure out the deadlocks
in the watcher later.

Signed-off-by: ttimonen <[email protected]>
While watchDispatcher doesn't grow unboundedly anymore, it can't be torn down trivially.
This is fixable, but a fix for that would leak more complexity into the storage layer.

Signed-off-by: ttimonen <[email protected]>
@matthyx
Copy link
Contributor

matthyx commented Jul 26, 2024

Thanks for your PR @ttimonen I'm going away for a week and will probably need a few days to fully comprehend your changes... stay tuned!

@matthyx
Copy link
Contributor

matthyx commented Aug 20, 2024

@ttimonen thanks again for your work, it took me a while to validate it but it works perfectly!

@matthyx matthyx merged commit 8c34f8d into kubescape:main Aug 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants