apache / apache/curator

[CURATOR-28] Add Expiry Time To InterProcessLocks

Open
#549 11 comments 0 reactions 0 assignees View on GitHub
imported-jira-issue rfe
Dominant language
Java
Stars
3.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

If a client takes a distributed lock and fails without breaking its zookeeper connection (e.g. the main application thread deadlocks) then that lock will never be released (at least without manual intervention, e.g. killing the process that has it). When a client's acquiring a lock I'd like to be able to specify a time after which the lock is automatically released. If the client currently holds the lock it should be able to extend this time period as many times as it likes. A write-up for what I'm describing for redis is here: https://chris-lamb.co.uk/posts/distributing-locking-python-and-redis .

I can see a couple of ways of going about this - the lock lifetime could be stored in the node's date (and so clients could check if the node had expired by adding the lifetime to the node's ctime or mtime). However, comparing the client's current time with the expiry time in the node is probably not the right thing to do as the client's clock may be out of sync with the other clients (or the zookeeper nodes). It'd be nice if zookeeper could automatically delete nodes (i.e. release the lock) after a certain amount of time - i.e. make it the zookeeper cluster's decision when the lock is expired, not the client's decision. However, I'm not sure exactly how to do this...

Thanks,

---
Originally reported by 3l3ph4n1n3, imported from: Add Expiry Time To InterProcessLocks


  • status: Open
  • priority: Minor
  • resolution: Unresolved
  • imported: 2025-01-21

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.