Connecting dropped before handshake leaks the connection (no Drop cleanup)

Open
#681 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #682 by @drlukeangel — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
networking

Research direction

Locate the Connecting type and trace its pre-handshake lifecycle through implicit_close, ConnectionDriver, and EndpointInner; start by reading how connection drops currently signal cleanup. Confirm the change by exercising or adding coverage for an inbound handshake dropped before completion, with the connection state and associated channels removed from the endpoint maps.

Written by the indexing model from the issue text.

Description

Summary

In-progress (Connecting) connections that are dropped before the handshake completes are never
reclaimed, leaking connection state once per aborted inbound handshake. We hit this running noq
(under iroh) where remote peers are abruptly killed without a graceful close.

Root cause

Connecting has no Drop implementation, so dropping it before handshake completion never signals
the connection task. Pre-handshake, the idle timeout isn't yet in effect and there's no handshake
timeout, while the background ConnectionDriver and the EndpointInner event-channel sender keep
the connection alive. The half-open connection (and its channels/packet spaces) therefore lingers in
the endpoint maps indefinitely.

Proposed fix

Implement Drop for Connecting to implicit_close() the connection when dropped before handshake
completion, so the driver drains it and the endpoint removes the handle. PR to follow. (Open
question for maintainers: pair with an explicit pre-handshake timeout, or is drop-driven cleanup the
right scope?)

Dominant language
Rust
Stars
454
Forks
98
Avg merge
2d 8h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from n0-computer/noq

All issues in n0-computer/noq

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.