From 42b01beaca349200cc5c8dbf20e70faa7ae2c27a Mon Sep 17 00:00:00 2001 From: hzxuzhonghu Date: Tue, 19 Dec 2017 11:18:15 +0800 Subject: [PATCH 1/2] Cacher stopLock should be unlocked --- staging/src/k8s.io/apiserver/pkg/storage/cacher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher.go index 27ead5a1d7..0f5b4e2ff2 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher.go @@ -655,7 +655,7 @@ func (c *Cacher) Stop() { } c.stopLock.Lock() if c.stopped { - // avoid that it was locked meanwhile as isStopped only read-locks + c.stopLock.Unlock() return } c.stopped = true From 5faf31054412520ed199a85405c26fbcac404b5e Mon Sep 17 00:00:00 2001 From: hzxuzhonghu Date: Tue, 19 Dec 2017 14:06:19 +0800 Subject: [PATCH 2/2] fix typos --- staging/src/k8s.io/apiserver/pkg/storage/cacher.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher.go index 0f5b4e2ff2..36334a3662 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher.go @@ -676,7 +676,7 @@ func forgetWatcher(c *Cacher, index int, triggerValue string, triggerSupported b glog.V(1).Infof("Forcing watcher close due to unresponsiveness: %v", c.objectType.String()) } // It's possible that the watcher is already not in the structure (e.g. in case of - // simulaneous Stop() and terminateAllWatchers(), but it doesn't break anything. + // simultaneous Stop() and terminateAllWatchers(), but it doesn't break anything. c.watchers.deleteWatcher(index, triggerValue, triggerSupported) } } @@ -747,7 +747,7 @@ func (lw *cacherListerWatcher) Watch(options metav1.ListOptions) (watch.Interfac return lw.storage.WatchList(context.TODO(), lw.resourcePrefix, options.ResourceVersion, Everything) } -// cacherWatch implements watch.Interface to return a single error +// errWatcher implements watch.Interface to return a single error type errWatcher struct { result chan watch.Event } @@ -787,7 +787,7 @@ func (c *errWatcher) Stop() { // no-op } -// cacherWatch implements watch.Interface +// cachWatcher implements watch.Interface type cacheWatcher struct { sync.Mutex input chan *watchCacheEvent