Comments (11)
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.
yup, it is on my radar. Plan to add a dialOption to enforce a limit.
from grpc-go.
or have a context.Context for transport so that you can set deadline/timeout or issue cancellation.
from grpc-go.
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.
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.
No, I suggest grpc.Dial should have a ...grpc.DialOption
variadic argument, and have grpc.DialTimeout to return such an option.
from grpc-go.
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.
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.
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.
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.
fixed in #93
from grpc-go.
Related Issues (20)
- Delayed dns resolve after upgrade to v1.60.0 HOT 5
- channelz: SubChannel do not report their Target properly since 1.63 HOT 1
- xds: support LRS for all cluster types HOT 4
- Updating credentials of a running server HOT 7
- clusterimpl: update picker synchronously upon receipt of configuration update HOT 1
- cds: update picker synchronously upon receipt of configuration update
- rls: update picker synchronously upon receipt of configuration update
- Improve grpc-go/Documentation to clearly specify usage of `grpc.SetTrailer` function for adding metadata to send to client
- New ServerOption to set cancel insensitive "values" context. HOT 1
- Return the actual error from unary RPCs when `SendMsg()` returns `io.EOF` HOT 14
- protoc-gen-go-grpc: copy service comment to interfaces HOT 2
- Deprecate Dial and DialContext through a mechanism that doesn't trigger linters HOT 1
- Flaky test: 6/100K: Test/LRSClient HOT 2
- Docs: Document how to migrate from `Dial, DialContext, WithBlock, WithReturnConnectionError, FailOnNonTempDialError` to `NewClient` HOT 3
- Stop supporting 3 releases of Go HOT 4
- <invalid gRPC request method "PRI">, when happend grpc and http use sample port HOT 2
- It seems that there is a memory leak issue in the HandleStreams function. HOT 13
- When the client receives the "too many pings" error log, how to get the server's target or remoteIP information? HOT 4
- Improve the xDS bootstrap package HOT 2
- xds/bootstrap: `client_features` should be set completely by the client implementation HOT 1
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 grpc-go.