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

Update profile parameter "resolver.defaults.retry" #1258

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

Conversation

tgreenx
Copy link
Contributor

@tgreenx tgreenx commented Jul 19, 2023

Purpose

This PR updates resolver.defaults.retry profile parameter by making it more proper to its name. See "Changes" section below.

Context

Fixes #1070

Changes

  • Make it exclude the initial query. Note that the actual value of resolver.defaults.retry is silently incremented before being passed to Zonemaster-LDNS. This is needed because LDNS does count the initial query as a try with this parameter.
  • Update default values
  • Update documentation
  • Update unitary tests

How to test this PR

Unit tests should pass.

Also you can change the value of resolver.defaults.retry in share/profile.json and test manually with :

$ git diff
diff --git a/lib/Zonemaster/Engine/Nameserver.pm b/lib/Zonemaster/Engine/Nameserver.pm
index f5962f8d..71ae62cf 100644
--- a/lib/Zonemaster/Engine/Nameserver.pm
+++ b/lib/Zonemaster/Engine/Nameserver.pm
@@ -462,6 +462,8 @@ sub _query {
     $flags{q{timeout}}   = $href->{q{timeout}}   // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.timeout} );
     $flags{q{edns_size}} = $href->{q{edns_size}} // $UDP_EDNS_QUERY_DEFAULT;

+    say "query: ", $flags{q{retry}};
+
     if ( exists $href->{edns_details} ) {
         $flags{q{dnssec}}    = $href->{edns_details}{do} // $flags{q{dnssec}};
         $flags{q{edns_size}} = $href->{edns_details}{size} // $flags{q{edns_size}};


$ perl -MZonemaster::Engine -E 'say "default: ", Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.retry} ); my
 $ns = Zonemaster::Engine->ns( "ns2.nic.fr", "192.93.0.4" ); say "ns: ", $ns->dns->retry; my $p = $ns->query( "zonemaster.net", "A", { retry => 5 } ); say "final: ", $ns
->dns->retry;'
default: 1
ns: 2
query: 6
final: 2

This commit updates "resolver.defaults.retry" profile parameter by making it more proper to its name:

- Make it exclude the initial query.
  Note that the actual value of "resolver.defaults.retry" is silently incremented before being passed to Zonemaster-LDNS. This is needed because LDNS does count the initial query as a try with this parameter.
- Update default values
- Update documentation
- Update unitary tests
@tgreenx tgreenx added the V-Minor Versioning: The change gives an update of minor in version. label Jul 19, 2023
@tgreenx tgreenx added this to the v2023.2 milestone Jul 19, 2023
@tgreenx tgreenx requested review from mattias-p, matsduf, hannaeko, a user and marc-vanderwal July 19, 2023 14:37
@tgreenx tgreenx linked an issue Jul 19, 2023 that may be closed by this pull request
@mattias-p
Copy link
Member

This is a breaking change. In previous versions you could set retry=1 to disable retrying, but with this change such installations will in fact start retrying unless the configuration is updated.

@mattias-p mattias-p added V-Major Versioning: The change gives an update of major in version. and removed V-Minor Versioning: The change gives an update of minor in version. labels Jul 21, 2023
@matsduf
Copy link
Contributor

matsduf commented Jul 21, 2023

I am not against the change, but I think its value is marginal since the parameter is probably almost never changed. Unless there is another change that triggers a V-Major I do not think we should do it. I do not really see the gain.

@marc-vanderwal
Copy link
Contributor

It is indeed a breaking change, but I welcome it for the following reasons:

  1. it was necessary to fix a problem emerging from a poorly-worded and misleading variable name. As a design flaw, the longer we wait to fix it, the harder it becomes to carry out the change, so we might as well do it now;
  2. it will only affect a minority of existing installations whose administrators tweaked resolvers.defaults.retry;
  3. it’s a low-risk change: the worst that can happen to an administrator who forgets to read the upcoming version’s release notes is that their Zonemaster installation retries DNS queries once too many with respect to what the administrator wanted. It might cause some slightly increased network or server load in degraded conditions, but it won’t cause name servers to be falsely diagnosed as unresponsive.

@matsduf
Copy link
Contributor

matsduf commented Jul 24, 2023

Another option would be to add resolvers.defaults.tries defined as resolvers.defaults.retry is defined today, and then deprecate resolvers.defaults.retry and remove it after a year or so when we have another breaking change.

@marc-vanderwal
Copy link
Contributor

Thing is, the more I look at it, the more I doubt about whose responsibility it is to fix the underlying issue. I see that the value of resolver.defaults.retry is directly fed to ldns_resolver_set_retry() in LDNS, so this means that they, too, have made a poor naming choice. And if they decide to remedy it, it’s going to be a breaking change for us.

Such a change needs more thought.

@mattias-p
Copy link
Member

Thing is, the more I look at it, the more I doubt about whose responsibility it is to fix the underlying issue. I see that the value of resolver.defaults.retry is directly fed to ldns_resolver_set_retry() in LDNS, so this means that they, too, have made a poor naming choice. And if they decide to remedy it, it’s going to be a breaking change for us.

I agree that this is a problem we inherited from LDNS. Redefining the semantics of ldns_resolver_set_retry() in LDNS would be a breaking change and callers would have to perform version number checks to know which semantics they'd be getting. Maybe we should raise this problem in their issue tracker. A more reasonable fix in LDNS would be to introduce a new method (with semantics that are in line with its name). Or maybe they'll just leave it as is.

Right now some of our profile properties mirror interfaces provided by LDNS. But we are the ones responsible for interfaces we export. If LDNS would change its semantics, it is our responsibility to adapt so that our interfaces remain stable.

We all seem to agree that our current resolver.defaults.retry property is problematic. Two solutions have been proposed: 1) changing the semantics of resolver.defaults.retry, and 2) introducing resolver.defaults.tries, deprecating resolver.defaults.retry and adding a validation to make sure they're not both present at the same time.

With the first solution we export an interface that looks like it mirrors LDNS but really doesn't when you look closer. This would be a (small) source of confusion. And as @marc-vanderwal pointed out we risk changing the behavior of a few existing installations.

With the second solution there is a bit more work to be done for us, and the few users who actually use this property would have to update their configs before we remove the old property.

Personally I'm leaning more towards the second solution.

@matsduf matsduf modified the milestones: v2023.2, v2024.1 Dec 4, 2023
@tgreenx tgreenx modified the milestones: v2024.1, v2024.2 Jun 12, 2024
@matsduf matsduf modified the milestones: v2024.2, v2025.1 Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-Major Versioning: The change gives an update of major in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading wording on profile resolver.defaults.retry
4 participants