GRPC_DNS_SRV_LOOKUP_FAILED
grpc
network_error
ai_generated
true
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%Fix Rate
87%Confidence
1Evidence
2024-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| gRPC-go v1.62.0 | active | — | — | — |
| gRPC-java v1.61.0 | active | — | — | — |
| C-core v1.62.0 | active | — | — | — |
Root Cause
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.
generic中文
gRPC 的 DNS 解析器尝试解析服务的 SRV 记录,但 DNS 服务器返回 NXDOMAIN,因为 SRV 记录缺失或配置错误。
Official Documentation
https://grpc.io/docs/guides/dns-naming/Workarounds
-
95% success 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.
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.
-
90% success 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.
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.
-
85% success 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.
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.
中文步骤
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.
Dead Ends
Common approaches that don't work:
-
90% fail
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% fail
Disabling DNS resolution with grpc.lb_policy=round_robin does not fix the missing SRV record; the resolver still fails before load balancing starts.