GithubHelp home page GithubHelp logo

Comments (6)

bbangert avatar bbangert commented on August 17, 2024

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.

nekto0n avatar nekto0n commented on August 17, 2024

So recipe for now is to manually register a listener with hope that it will be implemented in future?

from kazoo.

bbangert avatar bbangert commented on August 17, 2024

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.

nekto0n avatar nekto0n commented on August 17, 2024

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.

nekto0n avatar nekto0n commented on August 17, 2024

Curator Lock suggests listening for both SUSPENDED and LOST and react accordingly.

from kazoo.

bbangert avatar bbangert commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.