A race is possible in etcd's Lock()

Open
#177 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
go

Research direction

Start in store/etcd/etcd.go at the Lock() Set call around line 499, then read Unlock() around line 591 and trace how l.last is updated across concurrent calls. Confirm the failing interleaving described in the issue; done means a successful lock is still released by Unlock() even when another goroutine's Set() fails.

Written by the indexing model from the issue text.

Description

Consider line 499:

l.last, err = l.client.Set(context.Background(), l.key, l.value, setOpts)

It is possible for Set() to succeed, and immediately the following call to Set() from a different goroutine to fail - modifying l.last to be nil. Which will then result in Unlock() not issuing a Delete call and so not unlocking.

Dominant language
Go
Stars
847
Forks
204
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/libkv

All issues in docker/libkv

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.