Comments (4)
(First off, thanks @samuel for the library. I was very happy to find a pure-Go Zookeper option!)
I recently ran into the issue raised by @onsi while working on the zk command line client based on this library. For reference, the error
looks like:
$ zk children /
2014/05/20 20:03:42 Failed to connect to 192.168.12.12:2182: dial tcp 192.168.12.12:2182: i/o timeout
2014/05/20 20:03:43 Failed to connect to 192.168.12.13:2182: dial tcp 192.168.12.13:2182: i/o timeout
2014/05/20 20:03:44 Failed to connect to 192.168.12.11:2182: dial tcp 192.168.12.11:2182: i/o timeout
2014/05/20 20:03:46 Failed to connect to 192.168.12.12:2182: dial tcp 192.168.12.12:2182: i/o timeout
Where the log messages above are emitted by the go-zookeeper library.
This is problematic for me for a couple reasons:
- With control not returning to the caller in the case of connection-time errors I'm not able to present a good error message to the user.
- The library emits log messages which I have no control over in terms of destination, formatting, etc.
@samuel do you have any thoughts about what could be done in the library and/or in calling code to handle connection-time errors to servers? I would be happy to make changes in my code and/or consider writing a patch for this library. Some ideas:
- The caller just needs to set up their own timeout, perhaps calling Close if it hits the timeout branch.
- If the library can't establish a connection with the first server it tries when Connect is called, return an error. Or return an error after all servers have been tried once. The calling code could retry Connects if it wanted to.
- Some sort of pluggable logging setup (this would only address the second point above).
from go-zookeeper.
Sorry, I should gotten to this a while back :)
I'm not sure if a timeout or instant fail is the best and open to either option, but I implemented the instant fail when all servers are tried but none succeed. This I hope will solve the common problem of waiting forever. For logging, it's possible to add an optional way to set a custom logger (accepting a log.Logger interface), but I'll leave that for another patch.
Let me know if this works for you. Thanks!
from go-zookeeper.
Hey @samuel, thanks, this does definitely help. With this change we're able to avoid looping forever in our CLI tool / having to force an out-of-band timeout.
There are still some log messages that get dumped, but as you mentioned we can circle back on that latter.
from go-zookeeper.
Merged #30
from go-zookeeper.
Related Issues (20)
- cannot connect ZooKeeper 3.4.6.2.5
- Can not get event channel from the channel returned by Connect
- How Connect Zk Cluster HOT 1
- Set timeouts now occur after error check
- Support Go Mod? HOT 2
- Zookeeper clients contending for distributed lock get into deadlock state during network partition failure
- Conn AddAuth not working? HOT 3
- client cannot work when a server node in the cluster died HOT 1
- Exists api return true but path does not exist HOT 3
- DeleteRecursive(path string)
- Delete node(s) fails to delete without any error
- zookeeper node garbled code
- Is this project active? HOT 1
- why EventNodeDataChanged trigger children watch?
- can you release a version? HOT 1
- GSSAPI SASL authentication
- Why clear timeout when read a response from server? HOT 1
- Please make an issue menu in go-zk/zk repository, and archive this. HOT 1
- data race in conn.go
- How about archiving this repository?
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 go-zookeeper.