Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock with leases #109

Closed
connor4312 opened this issue Apr 15, 2017 · 2 comments
Closed

Lock with leases #109

connor4312 opened this issue Apr 15, 2017 · 2 comments

Comments

@connor4312
Copy link

connor4312 commented Apr 15, 2017

I was browsing through this client while working on a version for Node.js. I noticed that your locking is implemented on a straight k/v without using a lease. I suggest you consider using a lease for this, so that if something happens to the server or application which makes the lock, the resource isn't abandoned indefinitely. The downside is that it's possible that a lock is 'lost' while a process thinks it has it, but the set of situations in which that can occur and cause issues is a strict subset of the situations (only one I can think of: a partial network partition) in which the lock would otherwise be held indefinitely.

My implementation and little more reasoning is here, if you're interested: microsoft/etcd3#5

@kragniz
Copy link
Owner

kragniz commented Apr 15, 2017

The lock code is pretty dodgy, but it does use a lease https://github.com/kragniz/python-etcd3/blob/master/etcd3/locks.py#L57

It's mostly a stop-gap until etcd-io/etcd#7444 is released, at which point I'll switch to using that.

@connor4312
Copy link
Author

Ah, great. Somehow I skimmed over that. Nevermind then! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants