mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 19:25:56 +03:00
[PR #1699] [MERGED] Use tokio JoinSet for internally spawned server/resolver tasks #2530
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#2530
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/1699
Author: @jeff-hiner
Created: 4/19/2022
Status: ✅ Merged
Merged: 9/13/2022
Merged by: @bluejekyll
Base:
main← Head:taskset📝 Commits (5)
6c01147Require tokio 1.21e43cae6Use JoinSet for server tokio tasksc70d7d8Use JoinSet for resolver tokio tasks66774d9Late fixupsd611280Avoid verbose types via imports📊 Changes
19 files changed (+95 additions, -100 deletions)
View changed files
📝
Cargo.lock(+2 -2)📝
bin/Cargo.toml(+1 -1)📝
crates/recursor/src/recursor.rs(+6 -3)📝
crates/resolver/Cargo.toml(+1 -1)📝
crates/resolver/examples/flush_cache.rs(+1 -1)📝
crates/resolver/examples/global_resolver.rs(+1 -1)📝
crates/resolver/examples/multithreaded_runtime.rs(+1 -1)📝
crates/resolver/src/async_resolver.rs(+23 -23)📝
crates/resolver/src/dns_sd.rs(+1 -1)📝
crates/resolver/src/https.rs(+1 -1)📝
crates/resolver/src/name_server/connection_provider.rs(+8 -3)📝
crates/resolver/src/name_server/name_server.rs(+2 -2)📝
crates/resolver/src/name_server/name_server_pool.rs(+6 -3)📝
crates/resolver/src/resolver.rs(+2 -2)📝
crates/resolver/src/tls/mod.rs(+1 -1)📝
crates/server/Cargo.toml(+2 -2)📝
crates/server/src/server/server_future.rs(+33 -50)📝
crates/server/src/store/forwarder/authority.rs(+1 -1)📝
crates/server/tests/forwarder.rs(+2 -1)📄 Description
Switching to JoinSet has a few nice advantages.
The first and most obvious advantage is less code to maintain. No custom drop impl, no more newtype wrapper around JoinHandle.
The next is easier cancel safety-- from a resolver perspective, each connection has its own set of tasks corresponding to pending queries. If a server terminates and drops a JoinSet containing multiple pending queries, every waiting task will abort when it hits an await point (generally this means immediately). In practice this means cleanup is more predictable, open sockets are dropped more quickly, and there's less noise in logs. Tasks abort rather than continuing despite nowhere to send results and emitting late log messages about broken channels.
Finally, this makes it a little more feasible to shift to a model where a server can autonomously restart failed sockets-- again, any in-flight transactions that can't be completed are automatically aborted when the parent JoinSet is dropped, so it's easier to reason that old responses won't be sent over a new connection.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.