Skip to content

test(node): dht_lookup.rs tears endpoints down unbounded and fire-and-forget #1831

Closed

Description

@yigitdot

Split out of #1830, which fixed the same defect in crates/node/tests/dht_integration.rs.

crates/node/tests/dht_lookup.rs does not declare mod support; and hand-rolls teardown:

  • TestServer::shutdown (crates/node/tests/dht_lookup.rs:117-121) aborts the accept loop and then does tokio::spawn(async move { ep.close().await }) — fire-and-forget. The test returns while the close is still in flight, so the runtime is torn down mid-close and the endpoint may never drain.
  • Call sites :275, :330, :382, :549, each preceded by a bare client_ep.close().await with no deadline of its own.

That is exactly the hazard support::shutdown documents at crates/node/tests/support/mod.rs:164-166: a caller that tears an endpoint down by hand is outside the helper's guarantee and can park until the .config/nextest.toml backstop (180s for this package) instead of failing in 15s with the stalled stage named.

Fix

Mirror what #1830 did for dht_integration.rs:

  1. Add mod support;; call it fully qualified as support::shutdown(...) since the file has a competing TestServer::shutdown method.
  2. Change the accept task's return type to JoinHandle<()> if it carries a decorative anyhow::Result. support::shutdown then returns a panicking server task's JoinError, so a handler panic in the accept loop fails its test rather than being discarded by .abort().
  3. Add into_teardown_parts(self) -> (JoinHandle<()>, Endpoint) and fold each test's client + server teardown into one support::shutdown call, client endpoint first — so a whole test's teardown costs one deadline, not one per endpoint.
  4. Delete the detached variant.

crates/node/tests/dht_loopback.rs:1580 and crates/node/tests/dht_integration.rs are both working templates.

Not a live flake

No failure has been attributed to this file. It is the same latent unbounded-park hazard, filed so the two DHT test binaries do not diverge.

Activity

  1. added
    kind:bug
    rust
    kind:test
    prio:low
    on Aug 26, 2026
  2. moved this from Backlog to Ready in deCDNon Aug 26, 2026
  3. self-assigned this
    on Aug 26, 2026
  4. moved this from Ready to In progress in deCDNon Aug 26, 2026
  5. moved this from In progress to Done in deCDNon Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugkind:testprio:lowrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions