lease pattern
A time-bounded exclusive grant. Holder gets exclusive access until the lease expires; if they want to keep it, they renew. Combines locking with automatic recovery — if the holder dies, the lease times out and someone else takes over.
A time-bounded exclusive grant. Holder gets exclusive access until the lease expires; if they want to keep it, they renew. Combines locking with automatic recovery — if the holder dies, the lease times out and someone else takes over.
symptoms
- need exclusive access but worry about a crashed holder blocking forever
- single-leader systems where the leader might disappear silently
causes
- traditional locks don't auto-release on holder death
- need a liveness signal built into the locking primitive
fixes
- TTL-bound lock + heartbeat to renew
- fencing token on every lease for safety against stale holders
- lease store backed by consensus (etcd, ZooKeeper)
you might say
- take a lease on it
- renew the lease
- lease expired