Skip to content

net: In a high latency environment, if the AAAA response contains SOA (i.e., an empty response), the pure Go parser (netdns=go) will return the message "Host not found". #78501

Description

@trend1237

Go version

go version go1.26.1 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG='netdns=cgo'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1125228400=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/opt/test/go.mod'
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/test/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/test/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I attempted to resolve a domain in a specific network environment where the application-level DNS latency is significantly higher than the network-level ICMP latency:

Network Latency (ICMP): Low. ping to 180.76.76.76 shows ~20ms.

DNS Application Latency: High. dig @180.76.76.76 registry.example.com shows a query time of ~800ms.

DNS Behavior: The server 180.76.76.76 returns a valid A record but an empty AAAA record containing an SOA record in the Authority Section.

All the privacy data in the log results have been appropriately replaced.

Output of the "dig" command

# dig @180.76.76.76 registry.example.com AAAA

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.16 <<>> @180.76.76.76 registry.example.com AAAA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55577
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;registry.example.com.         IN      AAAA

;; AUTHORITY SECTION:
example.com.           60      IN      SOA     ns1.example.com. admin.example.com. 1773027147 3600 300 1209600 1800

;; Query time: 54 msec
;; SERVER: 180.76.76.76#53(180.76.76.76)
;; WHEN: Thu Apr 02 17:42:13 CST 2026
;; MSG SIZE  rcvd: 108

Reproduction Code:

NetResolvDns.go

package main

import (
        "context"
        "fmt"
        "net"
        "time"
)

func main() {
        // Target domain name
        host := "registry.example.com"

        // Default parser
        resolver := net.DefaultResolver

        fmt.Printf("--- DNS Mode Comparison Test ---\n")
        fmt.Printf("Current environment variables GODEBUG: %s\n", os.Getenv("GODEBUG"))

        for i := 1; i <= 3; i++ {
                fmt.Printf("\nThe %d th attempt:\n", i)
                start := time.Now()

                // LookupHost will respectively call Pure Go or CGO (glibc) in different modes.
                addrs, err := resolver.LookupHost(context.Background(), host)
                duration := time.Since(start)

                if err != nil {
                        fmt.Printf("❌ Analysis failed! Error: %v\n", err)
                } else {
                        fmt.Printf("✅ Analysis successful! IP address: %v\n", addrs)
                }
                fmt.Printf("time-consuming: %v\n", duration)

                time.Sleep(1 * time.Second)
        }
}

What did you see happen?

I ran this test in two modes:

export GODEBUG=netdns=go (Pure Go Resolver)  →  This mode will output: `no such host`

export GODEBUG=netdns=cgo (CGO Resolver)  →  This mode can resolve domain names.

log

The execution result of NetResolvDns.go and the packet capture results obtained through tcpdump are shown in the attachment.

Tech_Report_Go_DNS_Resolver_Anomaly_Analysis_20260402.md

What did you expect to see?

The expected pure Go parser is expected to successfully return IPv4 addresses, which is consistent with the performance of the CGO parser under the same conditions.

The above issue should be consistent with the one discussed in issue #25321

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions