From b44bd6d2a9d769e2ce81cb839384a40bc876f144 Mon Sep 17 00:00:00 2001 From: fanmin shi Date: Wed, 10 May 2017 11:21:17 -0700 Subject: [PATCH] etcd-runner: fix race on nextc --- .../functional-tester/etcd-runner/command/election_command.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/functional-tester/etcd-runner/command/election_command.go b/tools/functional-tester/etcd-runner/command/election_command.go index 81f1d5cc9..24610187d 100644 --- a/tools/functional-tester/etcd-runner/command/election_command.go +++ b/tools/functional-tester/etcd-runner/command/election_command.go @@ -129,8 +129,10 @@ func runElectionFunc(cmd *cobra.Command, args []string) { return err } if observedLeader == v { - close(nextc) + oldNextc := nextc nextc = make(chan struct{}) + close(oldNextc) + } <-rcNextc observedLeader = ""