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 race condition when switching ns. #372

Merged
merged 2 commits into from
Oct 19, 2019
Merged

fix race condition when switching ns. #372

merged 2 commits into from
Oct 19, 2019

Conversation

paivagustavo
Copy link
Contributor

It is a good practice to let writers of a channel to close it. This ensure that we only close the channel if the informer is not writing to it.

Informers was being closed when we switch namespaces but the informer could be in the middle of updating method and cause a panic due writing to a closed chan. This is a really rare case, you can come across it when switching ns in the pods view.

It is really rare, I could reproduce it adding some sleeps in the code.

@derailed derailed merged commit 4a59084 into derailed:master Oct 19, 2019
@derailed
Copy link
Owner

Thank you @paivagustavo! Sometimes I just need to lay off the pipe... Good catch!!

@paivagustavo paivagustavo deleted the fix-race-condition-when-switching-ns branch October 19, 2019 17:37
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this pull request Apr 3, 2024
…when-switching-ns

fix race condition when switching ns.
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.

2 participants