Skip to content

Commit a1b18e5

Browse files
authored
Add aws-smithy-dns crate and HickoryDnsResolver (#4274)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Add an optional in-memory `HickoryDnsResolver` to `aws-smithy-runtime`. This is mostly targeted at supporting customers on AL2023 since it has disabled OS level DNS caching by default. Hyper relies on OS DNS caching if no DNS resolver is provided and this has led to some DNS throttling for users. See links below for examples: * https://www.madebymikal.com/amazon-linux-2023-dns-and-systemd-resolved-a-story-of-no-caching/ * https://repost.aws/questions/QUXJ5yuiRpQE2c2Htf4Dc9iA/dns-caching-in-amazon-linux-2023 * https://repost.aws/knowledge-center/dns-resolution-failures-ec2-linux We leverage the [hickory-resolver](https://crates.io/crates/hickory-resolver) crate to provide this functionality. ## Description <!--- Describe your changes in detail --> Add new `HickoryDnsResolver` under `aws_smithy_dns`. This wraps a `hickory_resolver::Resolver` and provides some minimal configuration options (timeouts, retries, etc.) that seem unlikely to ever go away even though the `hickory-dns` ecosystem is still pre-1x. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Added new integration tests at `tests/hickory.rs`. These tests spin up an in-process DNS server on a random port and query it over `localhost`. Had to fix `CrateSetTest.kt` since the TOML library we use in Kotlin won't parse Cargo.toml files with `cfg` statements like `[target.'cfg(not(target_family = "wasm"))'.dependencies]`. I had to add one of those statements to prevent `hickory-resolver` from being compiled for WASM targets since it was introducing a tokio feature that caused compilation to fail and that caused `aws-smithy-runtime` to fail in the stability test. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent abeb550 commit a1b18e5

File tree

15 files changed

+1896
-83
lines changed

15 files changed

+1896
-83
lines changed

.changelog/caching-dns-resolver.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applies_to:
3+
- client
4+
authors:
5+
- landonxjames
6+
references:
7+
- smithy-rs#4274
8+
breaking: false
9+
new_feature: true
10+
bug_fix: false
11+
---
12+
Add a new crate, `aws-smithy-dns` that contains a `HickoryDnsResolver`. This wraps a `hickory_resolver::Resolver` and provides some minimal configuration options (timeouts, retries, etc.) Instructions for overriding the DNS resolver on your HTTP client can be found in our documentation at https://docs.aws.amazon.com/sdk-for-rust/latest/dg/http.html#overrideDns

aws/rust-runtime/Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)