Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The recursor cache needs to check stale when updating the ns type cache. #14117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zjs604381586
Copy link

Short description

When an NS record already exists in the recursor cache and the NS record is replaced again, the TTD setting of the NS record should check the stale flag of CacheEntry. Otherwise, the TTL of the NS cache will always be s_serveStaleExtensionPeriod(30s). Then the new NS cache will expires quickly, causing delays in iterative DNS resolution

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
  • checked that this code was merged to master

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8864635806

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 41 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+0.01%) to 59.464%

Files with Coverage Reduction New Missed Lines %
pdns/iputils.hh 1 74.8%
pdns/pollmplexer.cc 1 82.39%
pdns/dnsdistdist/dnsdist.cc 2 68.36%
pdns/communicator.cc 3 71.85%
modules/gpgsqlbackend/spgsql.cc 3 67.46%
pdns/auth-secondarycommunicator.cc 3 64.59%
pdns/dnsdistdist/dnsdist-tcp.cc 5 76.05%
pdns/rcpgenerator.cc 5 89.5%
pdns/recursordist/test-syncres_cc1.cc 8 89.46%
pdns/tcpiohandler.cc 10 66.67%
Totals Coverage Status
Change from base Build 8830304531: 0.01%
Covered Lines: 114204
Relevant Lines: 159427

💛 - Coveralls

@rgacogne
Copy link
Member

Thanks! I see the issue, but I'm a bit concerned that this exact fix would make it possible for a child zone to stay alive forever, even if the parent disagrees, as long as serve-stale is enabled. We might have to be a bit smarter and only bypass the check when we are actually refreshing a staled entry. Let's see what Otto thinks about it.

@omoerbeek omoerbeek self-requested a review May 8, 2024 06:54
@omoerbeek
Copy link
Member

I think not capping on cacheEntry.d_servedStale == 0 is not right.
The capping needs take into account the remaining serve stale time. Look at MemRecursorCache::updateStaleEntry for inspiration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants