Giter VIP home page Giter VIP logo

Comments (6)

GlenWalker avatar GlenWalker commented on June 3, 2024 1

I think we should change resolve_server to return {ok, Result} or {error, Reason} rather than always a bare list. It should return {ok ,[]} only for {error, nxdomain} and return any others errors unchanged.

resolve_servers will need to be updated to handle the new {ok, Result} or {error, Reason} return from resolve_server, and also to return {ok, Result} or {error, Reason} instead of a bare list. It should return any errors from resolve_server immediately.

init will need to be updated to handle the new {ok, Result} or {error, Reason} return from resolve_servers and if {ok, []} or {error, Reason} are returned, it should return {stop, Reason} rather than continuing on to deduplicate and shuffle the list, and attempt to connect.

I think this behaviour is consistent with the Java implementation, and should fix the issue. I'll try to find time to make a pull request for this.

from erlzk.

zolazhou avatar zolazhou commented on June 3, 2024

Thank you for the detailed report.

Your ideas for fixing sounds good for me, and pull request is very welcomed.

from erlzk.

GlenWalker avatar GlenWalker commented on June 3, 2024

It might be worth tracking what type of error is returned by inet:gethostbyname (transient errors like timeouts, or permanent errors like nxdomain). If all calls to inet:gethostbyname return permanent errors then give up, but if all calls return transient errors then keep retrying, and if any calls succeed in resolving a name then continue.

When I made the changes related to DNS resolution, retrying etc in #9 I tried to make the behaviour of erlzk similar to the Java library for ZooKeeper, so it might be worth reading through that to see if it gives any hints. If I have any time I'll take a look.

from erlzk.

zolazhou avatar zolazhou commented on June 3, 2024

@GlenWalker That would be very nice, and thank you for your previous improvements to erlzk again.

from erlzk.

GlenWalker avatar GlenWalker commented on June 3, 2024

Thanks! We should probably also tag this as v0.6.4 too, since I updated package.exs and erlzk.app.src to 0.6.4

from erlzk.

zolazhou avatar zolazhou commented on June 3, 2024

@GlenWalker Yes, done. Really appreciated for your contribution.

from erlzk.

Related Issues (10)

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.