{"record":{"id":"ed99fcd740163909","repo":"vitessio/vitess","slug":"connection-dns-for-s-reporting-as-empty-ignoring","errorCode":null,"errorMessage":"Connection DNS for %s reporting as empty, ignoring","messagePattern":"Connection DNS for (.+?) reporting as empty, ignoring","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/netutil/netutil.go","lineNumber":145,"sourceCode":"//\treturns true if the DNS name resolution has changed\n//\tIf there is a lookup problem, we pretend nothing has changed\nfunc DNSTracker(host string) func() (bool, error) {\n\tdnsName := host\n\tvar addrs []net.IP\n\tif dnsName != \"\" {\n\t\taddrs, _ = dnsLookup(dnsName)\n\t}\n\n\treturn func() (bool, error) {\n\t\tif dnsName == \"\" {\n\t\t\treturn false, nil\n\t\t}\n\t\tnewaddrs, err := dnsLookup(dnsName)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif len(newaddrs) == 0 { // Should not happen, but just in case\n\t\t\treturn false, fmt.Errorf(\"Connection DNS for %s reporting as empty, ignoring\", dnsName)\n\t\t}\n\t\tif !addrEqual(addrs, newaddrs) {\n\t\t\toldaddr := addrs\n\t\t\taddrs = newaddrs // Update the closure variable\n\t\t\treturn true, fmt.Errorf(\"Connection DNS for %s has changed; old: %v  new: %v\", dnsName, oldaddr, newaddrs)\n\t\t}\n\t\treturn false, nil\n\t}\n}\n\nfunc addrEqual(a, b []net.IP) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor idx, v := range a {\n\t\tif !net.IP.Equal(v, b[idx]) {\n\t\t\treturn false\n\t\t}","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/netutil/netutil.go#L127-L163","documentation":"DNSTracker's refresh closure calls dnsLookup and requires at least one address for the tracked hostname. This error is the defensive guard for a successful lookup that inexplicably returns an empty IP list; the tracker refuses to update its cached addresses in that case.","triggerScenarios":"A DNSTracker checkAndRefreshDNS cycle where net.LookupHost succeeds for the connection's DNS name but returns zero IPs.","commonSituations":"Custom resolver/NSS modules returning empty success; unusual DNS responses with no answers; hostname present in /etc/hosts with malformed/missing address field.","solutions":["Fix the hostname's entry so it maps to at least one IP in /etc/hosts or DNS","Inspect /etc/nsswitch.conf and resolver modules for empty-answer behavior","Test with `getent hosts <name>` to reproduce and confirm the fix","If recurring, replace DNSTracker usage with a resolver that handles empty answers"],"exampleFix":"// /etc/hosts, before\n10.0.0.6\n// after\n10.0.0.6 vttablet-1.example.com vttablet-1","handlingStrategy":"retry","validationCode":"addrs, err := net.LookupHost(dnsName)\nif err != nil || len(addrs) == 0 {\n    return fmt.Errorf(\"hostname %q unusable\", dnsName)\n}","typeGuard":null,"tryCatchPattern":"changed, err := tracker.Check()\nif err != nil {\n    log.Warn(\"DNS refresh failed; will retry next cycle\", slog.Any(\"error\", err))\n    // keep old cached addresses; retry on next check\n}","preventionTips":["Ensure hostnames in /etc/hosts include a valid address field","Test `getent hosts <name>` for tracked hostnames during deploy validation","Avoid custom NSS modules that return empty success"],"tags":["network","dns","empty-result"],"backgroundTag":"dns-lookup-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}