-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
hi, my question as below:
-
I use grpc balance, so I init a grpcclient use function grpc.Dial with parameter service name:
conn, err = grpc.Dial(servicename,...,grpc.WithBalancer(balancer)) -
the function grpc.Dial use DialContext, and my master routine will block here:
ch := cc.dopts.balancer.Notify()
if ch == nil {
// There is no name resolver installed.
addrs = append(addrs, Address{Addr: target})
} else {
addrs, ok = <-ch
if !ok || len(addrs) == 0 {
waitC <- errNoAddr
return
}
}
Because of no address available, there is not element([]Address) input into the channel.So, the dial will return "grpc: timed out when dialing".
- I can change it, input a empty []Address when actually no address in initialization phase, but it satisfys:
if !ok || len(addrs) == 0 {
so dial will also return an error,and it is "grpc: there is no address available to dial" .
In our system, we have much processes implement different serivce. Unfortunately, these processes is a situation of mutual dependence. So I can't init any first process because i make it exit when dial fail, saddly this will lead to i can't start our system.
Actually I just hope dial return a grpc.ClientConn even if there is no address available.I think this can solve my problem.