fqdn: DNSCache grows unbounded for the same IP with different FQDNs, causing DNS latency and drop
Is there an existing issue for this?
- I have searched the existing issues
Version
equal or higher than v1.19.7 and lower than v1.20.0
What happened?
When many distinct FQDNs resolve to the same IP address, the DNS names accumulated against that IP are never cleaned up if the IP is still in use by an open connection. The agent pins that IP as an alive "zombie" so it is never reaped, keeps appending every newly-resolved name to it, and re-inserts the entire accumulated name list into the DNS cache on every GC cycle. The cache therefore grows without bound for as long as the connection stays open, GC cycles take progressively longer, DNS resolution latency climbs, and DNS responses are eventually dropped.
As the cache grows, garbage collection gets slower, we observed a single GC pass taking ~90 seconds to walk ~160,000 DNS cache entries. GC holds the global FQDN cache lock for that entire pass, and every DNS response must take the same lock to record its result.
Note: Related but distinct from https://github.com/cilium/cilium/issues/47128.
How can we reproduce the issue?
The idea is to generate DNS churn with different FQDN resolving to the same IP while having an active connection with that IP. On kind cluster I had to change the coredns to resolve to single IP to replicate the issue. Pasting the script for replication: repro-fqdn-same-ip.sh
Cilium Version
1.19.6 (Seen in prev cilium version as well)
Kernel Version
6.6.114.1-microsoft-standard-WSL2 (kind on Debian 12 bookworm nodes, containerd 2.0.2)
Kubernetes Version
v1.36.4
Regression
Not known to be a regression, seen in v1.18.12 as well.
Sysdump
Relevant log output
level=warn msg="Timed out waiting for datapath updates of FQDN IP information; returning response. Consider increasing --tofqdns-proxy-response-max-delay if this keeps happening." module=agent.controlplane.fqdn.fqdn-msg-handler
level=warn msg="Name lock acquisition time took longer than expected. Potentially too many parallel DNS requests being processed, consider adjusting --dnsproxy-lock-count and/or --dnsproxy-lock-timeout" module=agent.controlplane.fqdn.fqdn-msg-handler
level=info msg="FQDN garbage collector work deleted entries" module=agent.controlplane.fqdn.namemanager controller=dns-garbage-collector-job lenEntries=399437
level=info msg="FQDN garbage collector work deleted entries" module=agent.controlplane.fqdn.namemanager controller=dns-garbage-collector-job lenEntries=401704
level=info msg="FQDN garbage collector work deleted entries" module=agent.controlplane.fqdn.namemanager controller=dns-garbage-collector-job lenEntries=381018Anything else?
No response
Cilium Users Document
- Are you a user of Cilium? Please add yourself to the Users doc
Code of Conduct
- I agree to follow this project's Code of Conduct
Source: cilium/cilium