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 deadlock possibility in federated informer #30872

Merged
merged 1 commit into from
Aug 18, 2016

Conversation

mwielgus
Copy link
Contributor

@mwielgus mwielgus commented Aug 18, 2016

On cluster add subinformer locks and tries to add cluster to federated informer. When someone checks if everything is in sync federated informer is locked and then subinformer is inspected what apparently requires a lock. With really bad timing this can create a deadlock.

This PR ensures that there is always at most 1 lock taken in federated informer.

cc: @quinton-hoole @kubernetes/sig-cluster-federation

Fixes: #30855


This change is Reviewable

@mwielgus mwielgus added retest-not-required release-note-none Denotes a PR that doesn't merit a release note. labels Aug 18, 2016
@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 18, 2016
@@ -344,8 +344,6 @@ func (f *federatedInformerImpl) getReadyClusterUnlocked(name string) (*federatio

// Synced returns true if the view is synced (for the first time)
func (f *federatedInformerImpl) ClustersSynced() bool {
f.Lock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing this one?

Copy link
Contributor Author

@mwielgus mwielgus Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because clusterInformer is set only once in the "constructor". It is never modified. So there is no need for locking.

@wojtek-t
Copy link
Member

One comment - other than that lgtm.

@k8s-bot
Copy link

k8s-bot commented Aug 18, 2016

GCE e2e build/test passed for commit 681d153.

@mwielgus
Copy link
Contributor Author

@k8s-bot unit test this issue: #30885

@mwielgus mwielgus added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 18, 2016
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit b15c2d6 into kubernetes:master Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants