From d3639aff7397dd0f0d3553b82043401ff834a356 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Fri, 5 Feb 2016 08:31:55 +0100 Subject: [PATCH] Fix deadlock in watch cache --- pkg/storage/watch_cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/storage/watch_cache.go b/pkg/storage/watch_cache.go index eeb451f003b..2e842a28e1e 100644 --- a/pkg/storage/watch_cache.go +++ b/pkg/storage/watch_cache.go @@ -220,13 +220,13 @@ func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64) ([]interface{ }() w.RLock() + defer w.RUnlock() for w.resourceVersion < resourceVersion { if w.clock.Since(startTime) >= MaximumListWait { return nil, 0, fmt.Errorf("time limit exceeded while waiting for resource version %v (current value: %v)", resourceVersion, w.resourceVersion) } w.cond.Wait() } - defer w.RUnlock() return w.store.List(), w.resourceVersion, nil }