Skip to content

Fix leaking ssh connections with VS Attach to Process#1552

Merged
WardenGnaw merged 3 commits intomainfrom
dev/waan/bug581
Mar 27, 2026
Merged

Fix leaking ssh connections with VS Attach to Process#1552
WardenGnaw merged 3 commits intomainfrom
dev/waan/bug581

Conversation

@WardenGnaw
Copy link
Copy Markdown
Member

@WardenGnaw WardenGnaw commented Mar 19, 2026

This PR address the issue where every SSH PortSupplier AD7Port will always create a new SSH connection on the remote machine when the Attach to Process window opens and closes. This causes ports to be kept open until VS completly closes.

The changes here are to cache an existing connection if VS opens and closes the attach to process window.
Adds a ref count mechanism to ensure if you are debugging multiple processes on the same machine, it does not Clean the connection until all processes are done.

Testing:
Ran ss -t state established sport = :22 to see how many connections exist.

  • Open Attach to Process, Attach to C++ Process with GDB = One Connection
  • Attach to Process and Detach = 0 Connections
  • Attach, Detach, and Reattach = 1 Connection
  • Attach, Detach, and Reattach and Detach = 0 Connections
  • Attach x2 Processes = 2 Connections
  • Attach x2, Detach All = 0 Connections
  • Attach x2, Detach All, Reattach x2 = 2 Connections
  • Attach -> Detach -> Attach - >Detach -> Attach -> Detach = 0 Connections
  • Open Attach to Process and Closed Window = 0 Connections (after second commit)

This PR address the issue where every SSH PortSupplier AD7Port will
always create a new SSH connection on the remote machine when the Attach
to Process window opens and closes. This causes ports to be kept open
until VS completly closes.

The changes here are to cache an existing connection if VS opens and
closes the attach to process window.
Adds a ref count mechanism to ensure if you are debugging multiple
processes on the same machine, it does not Clean the connection until
all processes are done.
Copy link
Copy Markdown
Member

@gregg-miskelly gregg-miskelly left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@WardenGnaw WardenGnaw merged commit cf41712 into main Mar 27, 2026
6 checks passed
@WardenGnaw WardenGnaw deleted the dev/waan/bug581 branch March 27, 2026 20:09
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.

2 participants