Skip to content

Fix local forward cleanup after disconnect - #833

Open
sean0407 wants to merge 1 commit into
ronf:developfrom
sean0407:codex/local-forward-peer-cleanup
Open

sean0407 wants to merge 1 commit into
ronf:developfrom
sean0407:codex/local-forward-peer-cleanup

Conversation

@sean0407

Copy link
Copy Markdown

Summary

SSHLocalForwarder._forward
  wait for the direct-tcpip channel
  if the local transport closed while waiting
    close the newly paired forwarders

Closes #823. I agree to release this contribution under EPL-2.0 and would like the contributors list entry to be Sean Li.

Evidence

  • Before: tests/test_forward.py -k disconnect_while_opening failed in both TCP forwarding test classes; the peer remained attached after the local transport closed.
  • After: tests/test_forward.py passed: 148 tests and 15 subtests.
  • The same regression test passed after the cleanup guard was added. git diff --check and the project patch policy passed (2 files, 36 changed lines, no binary files).

Merge Danger

Door: two-way

The cleanup closes the peer paired with a local forwarding connection that has already disconnected.

Blast Radius: narrow

Only local forwarding setup cleanup and its regression test change.

@ronf

ronf commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Thanks! This looks reasonable to me -- @ AlexMKX, what do you think, since you reported the original issue?

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (fab96ac) to head (415611f).
⚠️ Report is 242 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #833      +/-   ##
===========================================
+ Coverage    99.85%   99.87%   +0.02%     
===========================================
  Files           95      102       +7     
  Lines        27784    32571    +4787     
  Branches      2908     3147     +239     
===========================================
+ Hits         27743    32530    +4787     
  Misses          38       38              
  Partials         3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local port forward leaks the SSH channel if the client disconnects during channel open

2 participants