Skip to content

Conversation

@ramfox
Copy link
Member

@ramfox ramfox commented Nov 14, 2025

Description

Whenever we insert a new path, trigger pruning paths.

We currently only prune IP paths, and pruning paths only occurs if we have more than 30 IP paths.

We will prune any paths that did not successfully holepunch.

If there are still over 30 IP paths left, then we order the "inactive" paths (paths that have been closed, but at one point holepunched), and prune the paths that were closed earliest.

Notes and Questions

  • Added constants:
    • MAX_IP_PATHS = 30 - maximum IP paths per endpoint
    • MAX_INACTIVE_IP_PATHS = 10 - maximum inactive IP paths to keep
  • New PathState field:
    • status - tracks the PathStatus of the path
  • New PathStatus enum:
    • PathStatus::Open - is an open path
    • PathStatus::Inactive(Instant) - was opened once, but currently inactive
    • PathStatus::Unusable - we attempted to use it, but it never connected
    • PathStatus::Unknown - we don't know the status yet
  • New methods on RemotePathState:
    • abandoned_path - marks a path as abandoned with timestamp, triggered when we get the PathEvent::Abandoned event
    • prune_paths - triggers path pruning, occurs whenever we insert a path to the RemotePathState
    • changed insert to insert_open_path
  • New prune_ip_paths function with sophisticated logic:
    • Only prunes if IP paths exceed MAX_IP_PATHS
    • Never prunes active paths or paths of unknown status
    • Always prunes failed holepunch attempts (PathStatus::Unusable)
    • Keeps 10 most recently inactive paths that were previously
      successful
    • Special case: if all paths failed, keeps MAX_IP_PATHS instead of pruning everything
  • Added tests for edge cases and the typical case

@n0bot n0bot bot added this to iroh Nov 14, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Nov 14, 2025
@matheus23 matheus23 changed the base branch from main to feat-multipath November 17, 2025 08:17
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3666/docs/iroh/

Last updated: 2025-12-02T17:16:02Z

@ramfox ramfox changed the title wip feat: prune old, inactive paths feat: prune old, inactive paths Nov 17, 2025
@ramfox ramfox requested a review from flub November 17, 2025 19:04
@ramfox ramfox self-assigned this Nov 17, 2025
@ramfox ramfox added this to the v0.96 milestone Nov 17, 2025
@ramfox ramfox marked this pull request as ready for review November 17, 2025 19:09
@github-actions
Copy link

github-actions bot commented Nov 21, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 2492e77

@ramfox ramfox requested a review from matheus23 November 21, 2025 14:01
@ramfox ramfox changed the base branch from feat-multipath to feat-multipath-quic-nat November 23, 2025 13:34
@ramfox
Copy link
Member Author

ramfox commented Nov 23, 2025

@flub can I merge into feat-multipath-quic-nat? Looks like the same tests are failing.

Base automatically changed from feat-multipath-quic-nat to feat-multipath November 23, 2025 16:35
Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the previous comments addressed, this is good to go from my side.
Sorry that I effectively blocked this so long that we ended up with a bigger merge conflict :S

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic to prune seems ok. Though haven't really reviewed since the diff seems off, probably because the target branch has moved under your feet...

@ramfox
Copy link
Member Author

ramfox commented Dec 2, 2025

@flub this is reviewable now w/ rebases

same tests failing here that fail on feat-multipath

@ramfox ramfox requested a review from flub December 2, 2025 01:45
@ramfox ramfox merged commit 7fb80b9 into feat-multipath Dec 2, 2025
58 of 78 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Dec 2, 2025
@ramfox ramfox deleted the ramfox/prune branch December 2, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants