go
network_error
ai_generated
true
rpc错误:代码=不可用 描述=连接错误:拨号tcp:在127.0.0.11:53上查找主机:无此主机
rpc error: code = Unavailable desc = connection error: dial tcp: lookup host on 127.0.0.11:53: no such host
ID: go/grpc-unavailable-connection-error
80%修复率
88%置信度
0证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.22 | active | — | — | — |
| 1.23 | active | — | — | — |
根因分析
目标gRPC服务器主机名的DNS解析失败,通常是由于DNS配置错误或客户端连接字符串中的主机名不正确。
English
DNS resolution fails for the target gRPC server hostname, often due to misconfigured DNS or incorrect hostname in the client connection string.
解决方案
-
90% 成功率 Use IP address instead of hostname in the gRPC target.
conn, err := grpc.Dial("192.168.1.100:50051", grpc.WithInsecure()) -
85% 成功率 Configure custom DNS resolver in Go net package.
net.DefaultResolver = &net.Resolver{PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { d := net.Dialer{}; return d.DialContext(ctx, "udp", "8.8.8.8:53") }}
无效尝试
常见但无效的做法:
-
Retrying the same connection with backoff but not fixing DNS.
95% 失败
DNS resolution remains broken; retries never succeed.
-
Changing port number in the dial string.
98% 失败
The issue is hostname resolution, not port; changing port doesn't help.