Skip to content

Commit

Permalink
After winning a campaign, the call to waitDeletes was missing a
Browse files Browse the repository at this point in the history
slash after the key prefix. The result was deadlock due to
waiting on wrong keys.

Fixes #6278
  • Loading branch information
glycerine committed Aug 28, 2016
1 parent c388b2f commit bdd89f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clientv3/concurrency/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (e *Election) Campaign(ctx context.Context, val string) error {
}
}

err = waitDeletes(ctx, client, e.keyPrefix, v3.WithPrefix(), v3.WithRev(e.leaderRev-1))
err = waitDeletes(ctx, client, e.keyPrefix+"/", v3.WithPrefix(), v3.WithRev(e.leaderRev-1))
if err != nil {
// clean up in case of context cancel
select {
Expand Down
2 changes: 1 addition & 1 deletion clientv3/concurrency/mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (m *Mutex) Lock(ctx context.Context) error {
}

// wait for deletion revisions prior to myKey
err = waitDeletes(ctx, client, m.pfx, v3.WithPrefix(), v3.WithRev(m.myRev-1))
err = waitDeletes(ctx, client, m.pfx+"/", v3.WithPrefix(), v3.WithRev(m.myRev-1))
// release lock key if cancelled
select {
case <-ctx.Done():
Expand Down

0 comments on commit bdd89f1

Please sign in to comment.