GRPC_DNS_SRV_LOOKUP_FAILED
grpc
network_error
ai_generated
true
UNAVAILABLE: DNS 解析器:查询 _grpc._tcp.example.com 的 DNS SRV 记录失败:查找 _grpc._tcp.example.com:没有此主机
UNAVAILABLE: dns resolver: failed to query DNS SRV record for _grpc._tcp.example.com: lookup _grpc._tcp.example.com: no such host
ID: grpc/name-resolver-failure-dns
90%修复率
87%置信度
1证据数
2024-01-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| gRPC-go v1.62.0 | active | — | — | — |
| gRPC-java v1.61.0 | active | — | — | — |
| C-core v1.62.0 | active | — | — | — |
根因分析
gRPC 的 DNS 解析器尝试解析服务的 SRV 记录,但 DNS 服务器返回 NXDOMAIN,因为 SRV 记录缺失或配置错误。
English
gRPC's DNS resolver tried to resolve a SRV record for the service but the DNS server returned NXDOMAIN because the SRV record is missing or misconfigured.
官方文档
https://grpc.io/docs/guides/dns-naming/解决方案
-
Add the missing SRV record in DNS: _grpc._tcp.example.com. 3600 IN SRV 0 0 50051 server1.example.com. Also ensure A/AAAA records exist for server1.example.com.
-
Use the 'passthrough' resolver to bypass SRV lookup: set target URI to 'passthrough:///server1.example.com:50051' which resolves using standard A/AAAA records only.
-
Configure a custom resolver in code: in Go, implement resolver.Builder and register it with resolver.Register(myBuilder) to provide a static list of addresses.
无效尝试
常见但无效的做法:
-
90% 失败
Adding a fallback to IP address in the target URI (e.g., dns:///192.168.1.1:50051) bypasses service discovery entirely, breaking load balancing and failover.
-
85% 失败
Disabling DNS resolution with grpc.lb_policy=round_robin does not fix the missing SRV record; the resolver still fails before load balancing starts.