Zookeeper locks use ephemeral nodes . An ephemeral node is a node that lives as long as its created session is alive. Sessions are saved during the process, creating a session, periodically sending a core message to zookeeper.
So, if you kill the process that created the lock, the lock will eventually be released, as the session will die, since the zookeeper no longer receives heart contractions.
Thus, killing a worker before releasing the lock should ultimately release the lock.
If the lock is never released, a couple of things can happen,
- Someone noticed that the lock was released and received. Presumably you are blocking because there is competition, and some other process will try to get the lock when it is released.
- Woo is not waiting long enough. When you connect to the zookeeper, the session timeout setting must be set, that is, how long the server will keep the session waiting without any heart rate, you have to wait so long to see the blocked locks.
- There is a mistake in kazoo. This is possible, but it seems that the kazoo blocking recipe uses ephemeral nodes, and the example you are using is very simple.
It is very unlikely that this is a bug in zookeeper.
How do you know that a lock is not released?
sbridges
source share