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

Limit cache-max-negative-ttl in resolving #1292

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Limit cache-max-negative-ttl in resolving #1292

merged 2 commits into from
Feb 28, 2024

Conversation

mxsasha
Copy link
Collaborator

@mxsasha mxsasha commented Feb 28, 2024

No description provided.

@mxsasha mxsasha added the backport Fix to be backported label Feb 28, 2024
@baknu
Copy link
Contributor

baknu commented Feb 28, 2024

Please check #495 before implementing this change.

@mxsasha mxsasha changed the title Set cache-max-(negative-)ttl to 1 minute in resolvers Limit cache-max-negative-ttl in resolving Feb 28, 2024
Copy link
Collaborator

@gthess gthess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like explicitly setting the cache-max-negative-ttl even though normally there would not be a change in behavior. Only if settings.CACHE_TTL would be set to something higher than 1 hour roughly.

Comment on lines 41 to 45
self._ub_ctx.set_option("cache-max-negative-ttl:", str(settings.CACHE_TTL * 0.9))
# Some (unknown) tests probably depend on consistent ordering in unbound responses
# https://github.com/internetstandards/Internet.nl/pull/613#discussion_r892196819
self._ub_ctx.set_option("rrset-roundrobin:", "no")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change normally would have no effect. cache-max-ttl applies to all records in the cache. cache-max-negative-ttl applies after that only for negative records (NXDOMAIN, NOERROR) as an exception for those records. Since cache-max-ttl would normally be a value of less than 1 hour (default cache-max-negative-ttl) for internet.nl the change is moot. However, explicitly setting it as the same value would guarantee homogeneous behavior across different setups and configurations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ok, I will apply it then - original reason was a report that the test was not picking up new DNS records, then I looked in unbound config to find no cache-max-ttl at all, then realised it would be in the unbound context. So the original problem is likely not related to this, but it's still a good consistency fix.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If caching was a problem for new DNS records (especially in DNSSEC signed zones) then #495 may still be related. I changed its title because it was not only DNSSEC related.
Also in batch mode, all the pyunbounds forward to a central Unbound IIRC. That one also needs the proper TTL max values in its configuration.

Comment on lines 42 to 45
# Some (unknown) tests probably depend on consistent ordering in unbound responses
# https://github.com/internetstandards/Internet.nl/pull/613#discussion_r892196819
self._ub_ctx.set_option("rrset-roundrobin:", "no")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, the comment about rrset-roundrobin is for tests that get back a DNS answer but only care about the first X records from the results like the mailtest where only the first 8(?) mailservers are checked. Because this call to Unbound could be done from different places, turning off roundrobin guarantees that the same 8 in the mailtest for example will be used in different points of the code.

@mxsasha mxsasha removed the backport Fix to be backported label Feb 28, 2024
mxsasha added a commit that referenced this pull request Feb 28, 2024
See comments in #1292. Prevents stale responses.
@mxsasha mxsasha merged commit 098d6b7 into main Feb 28, 2024
17 checks passed
@mxsasha mxsasha deleted the maxcachettl branch February 28, 2024 14:26
@mxsasha mxsasha added the backport Fix to be backported label Feb 28, 2024
@bwbroersma bwbroersma mentioned this pull request Mar 18, 2024
@bwbroersma bwbroersma linked an issue Mar 25, 2024 that may be closed by this pull request
@mxsasha mxsasha removed the backport Fix to be backported label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Limit TTL
3 participants