Skip to content

Introduce configurable DNS resolution timeout#1113

Merged
Lorak-mmk merged 4 commits intoscylladb:mainfrom
muzarski:dns-resolution-timeout
Nov 26, 2025
Merged

Introduce configurable DNS resolution timeout#1113
Lorak-mmk merged 4 commits intoscylladb:mainfrom
muzarski:dns-resolution-timeout

Conversation

@muzarski
Copy link
Contributor

@muzarski muzarski commented Oct 30, 2024

Description by @Lorak-mmk , because I took over this PR from @muzarski .

This PR adds configurable DNS resolution timeout, configurable on SessionBuilder.

Additionally, I added a new variant of TranslationError - CustomTranslationError. It can be utilized by user-implemented AddressTranslators to return their own error types.
It is not connected to this PR, but I added it when trying to make this PR work without removing unstable-cloud feature, and then it was necessary.
I thought it is a nice improvement, so I left it in.

There are no tests in this PR - I don't think we have any infrastructure in place to test DNS in the driver, and introducing it is probably a bigger task.

Fixes: #1033

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • [ ] I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@muzarski muzarski self-assigned this Oct 30, 2024
@github-actions
Copy link

github-actions bot commented Oct 30, 2024

cargo semver-checks found no API-breaking changes in this PR.
Checked commit: 9158ab8

@muzarski muzarski force-pushed the dns-resolution-timeout branch from a01ba38 to 86e69d8 Compare December 11, 2024 16:05
@muzarski
Copy link
Contributor Author

Rebased on main

@Lorak-mmk
Copy link
Collaborator

Lorak-mmk commented Nov 25, 2025

Rebased on top of #1487 (which required some changes to the PR), addressed some review comments (but not all yet).
One thing left to address it the one with big discussion, about timeout being doubled,

@Lorak-mmk Lorak-mmk force-pushed the dns-resolution-timeout branch 5 times, most recently from 511dfe4 to 6089ef8 Compare November 25, 2025 12:15
@Lorak-mmk Lorak-mmk requested a review from wprzytula November 25, 2025 12:26
@Lorak-mmk Lorak-mmk force-pushed the dns-resolution-timeout branch from 6089ef8 to f9eeb14 Compare November 25, 2025 14:16
Lorak-mmk added a commit that referenced this pull request Nov 25, 2025
This PR removes unstable-cloud feature, and all related code including
tests, examples, CI workflow, and documentation.
I also decided to remove InternalKnownNode. It was introduced only
because of cloud, and I don't think we'll need that in the future.
I did not remove the hierarchy of TLS configurations. I think those make
conceptual sense, and we may need them in the future if we
introduce some more advanced TLS features (session tickets? More
flexible hostname verification?).

Why do this now? I want to rebase and update
#1113
When this PR was originally made, cloud feature was integrated
differently in the code. Updating the PR to current
cloud feature structure would require more work, and I don't see the
point of spending time on unused feature.

## Pre-review checklist

<!--
    Make sure you took care of the issues on the list.
    Put 'x' into those boxes which apply.
    You can also create the PR now and click on all relevant checkboxes.
    See CONTRIBUTING.md for more details.
-->

- [x] I have split my patch into logically separate commits.
- [x] All commit messages clearly explain what they change and why.
- [ ] ~~I added relevant tests for new features and bug fixes.~~
- [x] All commits compile, pass static checks and pass test.
- [x] PR description sums up the changes and reasons why they should be
introduced.
- [ ] ~~I have provided docstrings for the public items that I want to
introduce.~~
- [x] I have adjusted the documentation in `./docs/source/`.
- [ ] ~~I added appropriate `Fixes:` annotations to PR description.~~
@Lorak-mmk Lorak-mmk force-pushed the dns-resolution-timeout branch from f9eeb14 to 04181b2 Compare November 25, 2025 14:24
@Lorak-mmk
Copy link
Collaborator

Rebased on main

muzarski and others added 4 commits November 26, 2025 08:39
This option is responsible for setting the DNS hostname
resolution timeout.

The default timeout is set to 5 seconds.

Co-authored-by: Karol Baryła <karol.baryla@scylladb.com>
…nfig

These structs need this context to pass it forward to functions
responsible for DNS lookup.

Co-authored-by: Karol Baryła <karol.baryla@scylladb.com>
Passed the hostname_resolution_timeout down to the functions
responsible for DNS resolution logic.

Created a pub(crate) error type to distinguish between errors that
can occur during hostname resolution. Notice: it's pub(crate) since
the users of this API only emit logs in case of error. The errors are
not passed to public API.

Created a `lookup_host_with_timeout` function, and extracted
some logic here. The purpose is not to introduce complex branching
in original function.

Co-authored-by: Karol Baryła <karol.baryla@scylladb.com>
Initially I introduced it when trying to adapt DNS timeouts to work with
unstable-cloud. After removing unstable-cloud, I thought that it makes
sense to keep it in: users can implement their own address translators,
and without such variant they have no good way to return custom errors
from it (the bad way is to abuse IoError).
@Lorak-mmk Lorak-mmk force-pushed the dns-resolution-timeout branch from 04181b2 to 9158ab8 Compare November 26, 2025 07:41
@Lorak-mmk
Copy link
Collaborator

Rebased on main, addressed review comment

@Lorak-mmk Lorak-mmk requested a review from wprzytula November 26, 2025 07:41
@Lorak-mmk Lorak-mmk merged commit c31f2ee into scylladb:main Nov 26, 2025
11 checks passed
@wprzytula wprzytula mentioned this pull request Jan 29, 2026
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.

Configurable DNS resolve timeout

3 participants