Skip to content

Conversation

@xemul
Copy link
Contributor

@xemul xemul commented Nov 20, 2025

The test does three resolutions in a row -- hostname to address, then address to hostname and finally the reverse-resolved name back to address. The last list of IP-s is checked to contain front IP from the first list. The piggy host for the fun is seastar.io.

Sometimes, reverse resolution fails. E.g. 2b51022 changed the name from www.google.com to seastar.io with the explanation that google hostname's address cannot be resolved back. Now it happened with seastar.io (and www.google.com healed back). The proposal is to try several hostnames in a row, and tolerate the reverse lookup failure.

@xemul xemul requested a review from elcallio November 20, 2025 12:06
@xemul
Copy link
Contributor Author

xemul commented Nov 20, 2025

It's not my localhost problem, github CI also suffers. The branch that changes nothing, and the CI job on it that fails

hostent e = co_await d.get_host_by_name(seastar_name, inet_address::family::INET);
hostent a = co_await d.get_host_by_addr(e.addr_list.front());

try_again:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest:

while (!hostnames.empty()) {

try {
   auto d = ...;
  break;
} catch(...)
...
  continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, reimplemented with a for-loop

In case reverse resolution fails, try again with another host name.
At least one of them should succeed.

Signed-off-by: Pavel Emelyanov <[email protected]>
@xemul xemul force-pushed the br-dns-test-unresolvable-name branch from da4c487 to 7e0f288 Compare November 20, 2025 15:14
@xemul
Copy link
Contributor Author

xemul commented Nov 20, 2025

upd:

  • replaced goto with a for-loop

@crackcomm
Copy link
Contributor

It might be a good idea to use these domains:

$ dig +short one.one.one.one
1.0.0.1
1.1.1.1
$ dig +short dns.google     
8.8.4.4
8.8.8.8
$ dig +short localhost 
127.0.0.1

hostent a = co_await d.get_host_by_addr(e.addr_list.front());
hostent e2 = co_await d.get_host_by_name(a.names.front(), inet_address::family::INET);
BOOST_REQUIRE(std::count(e2.addr_list.begin(), e2.addr_list.end(), e.addr_list.front()));
co_await d.close();
Copy link
Member

Choose a reason for hiding this comment

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

This is not an accurate translation, we lose d.close() on exception. And since you do expect failures, we shouldn't leak here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failures that are "expected" don't lose close -- the d is created once before loop, and in case loop continues it re-uses that single resolver. Exceptions that are not caught make test fail anyway

Copy link
Member

Choose a reason for hiding this comment

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

aha

@avikivity
Copy link
Member

IMO, a better approach is to set up local dns with dnsmasq as a fixture so we have reliable infrastructure. But I don't known if it's worth the effort.

@avikivity avikivity merged commit 65cbae6 into scylladb:master Nov 21, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants