Coder Social home page Coder Social logo

Ping Timeouts? about kazoo HOT 6 CLOSED

justinrosenthal avatar justinrosenthal commented on August 16, 2024
Ping Timeouts?

from kazoo.

Comments (6)

bbangert avatar bbangert commented on August 16, 2024

The main reason I didn't account for this was because I assumed that writing to the dead connection would throw a socket error and cause the loop to exit and reconnect. How is the socket closed, yet can be written to for the ping?

from kazoo.

justinrosenthal avatar justinrosenthal commented on August 16, 2024

Great question. To be honest, I don't know the answer but that's exactly what's happening. The ZooKeeper logs very clearly state that the connection has been closed, the ephemeral data for that node is gone, but the client doesn't think anything out of the ordinary has happened: no state change, etc.

It's possible that virtualization might have something to do with it (I've seen the issue on EC2). Oddly enough, each time it's happened, the socket does close after 15 minutes -- and seemingly exactly 15 minutes every time.

However, it seems like a ping timeout may be useful in other situations, such as: if the ZooKeeper server is misbehaving (pegged CPU, swapping, etc?). Getting the client onto a healthy node before it's session expires would be great.

from kazoo.

bbangert avatar bbangert commented on August 16, 2024

Agreed, if a ping is not returned within (how many seconds exactly?), then the client should close its connection and try to reconnect.

Are you using the 0.9 release, or the latest beta?

In the latest beta, I think the best way to handle this would be for it to set an event when it sends a ping, and clear it when it gets a ping reply. It can check this event to see if a ping was already sent should it time-out in the loop again, and if it hasn't gotten the prior ping raise a ConnectionClosed exception.

from kazoo.

justinrosenthal avatar justinrosenthal commented on August 16, 2024

We've been using 1.0b1 and will be submitting a pull request shortly that implements the timeout as you suggested.

The timings: submit ping at 1/3 the timeout interval, expect pong within another 1/3 the timeout interval. If the pong isn't received, you then have 1/3 the timeout interval to connect to another server. This seemed to be the suggested approach on zookeeper-users.

from kazoo.

bbangert avatar bbangert commented on August 16, 2024

Let me know if this failed to resolve the issue and I'll reopen. Thanks!

from kazoo.

cablehead avatar cablehead commented on August 16, 2024

Cheers Ben, we appreciate it. Will do..

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.