Comments (6)
If the session disconnects, then the nodes are lost and the lock is lost. A listener should be added with client.add_listener and listen for the LOST state to mark a variable you have access to indicating the session was lost (or just bailing the process entirely, which is recommended in the Zookeeper wiki docs for handling a LOST session).
It'd prolly be good to have the lock itself reg a listener so it could be aware of session lost and set a flag on itself indicating it was lost that can be checked. But depending on how much state, locks, etc. have been registered with Zookeeper, its generally easier to bail the process and start fresh than attempt to recover (thus the Zookeeper doc recommendation).
from kazoo.
So recipe for now is to manually register a listener with hope that it will be implemented in future?
from kazoo.
Well, not "with hope", it will be added. :)
But I'd generally recommend following the Zookeeper guide docs and registering a listener that shuts down your program as gracefully as possible if the session state goes to LOST. If you're extremely familiar with Zookeeper and up for trying to re-establish all the state needed, backing up as appropriate to re-establish locks, etc, then you could try and recover yourself.
from kazoo.
Session won't go to LOST
until reconnected according to my tests and docs:
When a ZooKeeper client disconnects from a server, you will not receive notification of changes until reconnected.
So isolated/disconnected master will assume being master... creepy behaviour. All I get now is SUSPENDED
right after disconnect.
from kazoo.
Curator Lock suggests listening for both SUSPENDED
and LOST
and react accordingly.
from kazoo.
Yep, that applies with kazoo as well, im still in the process of writing up more of the general usage docs that will advise on these issues.
from kazoo.
Related Issues (20)
- Abort in `selector_select` HOT 1
- Make the ReadTheDocs CI check a required check for PR's HOT 1
- New kazoo release to include SSL fixes HOT 4
- Unhandled exception in connection loop when administrator sets system time in past HOT 1
- Documentation of the ZooKeeper wire protocol? HOT 1
- No handlers could be found for logger "kazoo.handlers.threading"
- Switch publishing to using the new Trusted Publishers action HOT 1
- RuntimeError: Invalid error code HOT 5
- KazooClient thread-safety and instance reuse HOT 4
- Zookeeper sequence node overflow causes perpetual re-election HOT 6
- Non-blocking lock acquisition failure can "leak" the ephemeral lock node.
- Zookeeper Server's watch residue
- Connecting to read only zookeeper HOT 1
- Add option to recursively set ACLs
- asyncio support HOT 4
- kazoo/client.py in python2.7 use KazooClient init throw a error HOT 1
- delete() fails with version greater than 2**31-1 HOT 2
- timeout param is not respected HOT 1
- Add support for SNI hostnames
- Connection timeout is not set to client._session_timeout / 1000 / len(client.hosts) in all places HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kazoo.