From e3311aa93ac6c3ad89d648129fc351aa5eae1e5a Mon Sep 17 00:00:00 2001 From: "Timothy St. Clair" Date: Fri, 18 Dec 2015 18:37:45 -0600 Subject: [PATCH] Fix data race on cancel variable in etcd code --- pkg/storage/etcd/etcd_watcher.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/storage/etcd/etcd_watcher.go b/pkg/storage/etcd/etcd_watcher.go index 7b6ac901771..9487728a459 100644 --- a/pkg/storage/etcd/etcd_watcher.go +++ b/pkg/storage/etcd/etcd_watcher.go @@ -158,7 +158,9 @@ func (w *etcdWatcher) etcdWatch(ctx context.Context, client etcd.KeysAPI, key st AfterIndex: resourceVersion, } watcher := client.Watcher(key, &opts) + w.stopLock.Lock() w.ctx, w.cancel = context.WithCancel(ctx) + w.stopLock.Unlock() for { resp, err := watcher.Next(w.ctx)