Coder Social home page Coder Social logo

Comments (11)

dsymonds avatar dsymonds commented on July 19, 2024 1

The net package (http://golang.org/pkg/net/) has a bunch of specific error types (e.g. AddrError or InvalidAddrError that can tell you such details. Or you can do an interface check (with net.Error) to see if the error has a Temporary() bool method that will tell you if it's a permanent failure.

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

yup, it is on my radar. Plan to add a dialOption to enforce a limit.

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

or have a context.Context for transport so that you can set deadline/timeout or issue cancellation.

from grpc-go.

dsymonds avatar dsymonds commented on July 19, 2024

Let's not just sprinkle options for things that we can simply do the right thing. A dial failure can fail in permanent/temporary ways. There's no point in doing any retries if the address is completely malformed, since it'll never get a connection. But a grpc.DialTimeout would be okay.

A context isn't a great choice for dialing. Contexts are meant to be request-scoped, and dialing should rarely be in the scope of a request. The OS primitives usually aren't cancellable either.

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

So you proposed adding another API grpc.DialTimeout? sgtm.

Regarding connection-scoped context, it was originally from bcmills on a previous code review. I actually think it is probably a good idea (but maybe overkill). For OS primitive, it is not special for connection-scoped context. It is the issue for request-scoped context too (e.g., a socket write stuck in kernel when the corresponding context is canceled/timeout).

from grpc-go.

dsymonds avatar dsymonds commented on July 19, 2024

No, I suggest grpc.Dial should have a ...grpc.DialOption variadic argument, and have grpc.DialTimeout to return such an option.

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

On Thu, Feb 26, 2015 at 5:20 PM, David Symonds [email protected]
wrote:

No, I suggest grpc.Dial should have a ...grpc.DialOption variadic
argument, and have grpc.DialTimeout to return such an option.

This is exactly what the current impl is (
https://github.com/grpc/grpc-go/blob/master/clientconn.go#L83) and my
original proposal then ...


Reply to this email directly or view it on GitHub
#76 (comment).

from grpc-go.

dsymonds avatar dsymonds commented on July 19, 2024

Your original proposal said "a configurable limit on retries", which I interpreted to mean a limit on the number of retries, which I think is a bad option. A limit on the total time trying to dial would be fine though. Even better would be to (also) detect the types of errors, and for the known-permanent failures (e.g. malformed address) have grpc.Dial fail immediately.

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

On Thu, Feb 26, 2015 at 5:53 PM, David Symonds [email protected]
wrote:

Your original proposal said "a configurable limit on retries", which I
interpreted to mean a limit on the number of retries, which I think is a
bad option. A limit on the total time trying to dial would be fine though.

I see. Sorry for confusion. Actually I was debating which one (timeout vs #
retries) is better at that time.

Even better would be to (also) detect the types of errors, and for the
known-permanent failures (e.g. malformed address) have grpc.Dial fail
immediately.

Yup. Is it possible to get some hint from the error returned by net.Dial
(e.g., DNS resolving failure)?


Reply to this email directly or view it on GitHub
#76 (comment).

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

On Thu, Feb 26, 2015 at 6:39 PM, David Symonds [email protected]
wrote:

The net package (http://golang.org/pkg/net/) has a bunch of specific
error types (e.g. AddrError or InvalidAddrError that can tell you such
details. Or you can do an interface check (with net.Error) to see if the
error has a Temporary() bool method that will tell you if it's a
permanent failure.

Nice, this is the thing I missed. Thanks!


Reply to this email directly or view it on GitHub
#76 (comment).

from grpc-go.

iamqizhao avatar iamqizhao commented on July 19, 2024

fixed in #93

from grpc-go.

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.