Skip to content

Bound AppHost auxiliary backchannel handshake - #19832

Open
Adam Ratzman (adamint) wants to merge 2 commits into
microsoft:mainfrom
adamint:adamint-fix-orphaned-apphost-stop
Open

Bound AppHost auxiliary backchannel handshake#19832
Adam Ratzman (adamint) wants to merge 2 commits into
microsoft:mainfrom
adamint:adamint-fix-orphaned-apphost-stop

Conversation

@adamint

Copy link
Copy Markdown
Member

Description

An AppHost that accepts its auxiliary socket but never answers JSON-RPC can no longer hang aspire run, aspire ps, aspire stop, or other backchannel-scanning commands indefinitely.

This adds a 10-second deadline around the shared AppHost information/capabilities handshake. The deadline is enforced locally even when the remote AppHost ignores RPC cancellation, and failed initialization now disposes JsonRpc and its owned stream/socket before returning the failure to the existing caller flow.

The tests cover an AppHost that stalls during either handshake RPC and verify that the client both times out and closes the connection. The separate issue where CliOrphanDetector allowed the original AppHost to survive is not changed here.

User-facing behavior

Commands such as:

aspire run --start-debug-session
aspire ps
aspire stop

now stop waiting for an unresponsive AppHost handshake after 10 seconds instead of hanging indefinitely.

Validation:

  • AppHostAuxiliaryBackchannelTests: 7 passed
  • Aspire.Cli.Tests: 5,482 passed, 35 skipped

Fixes #19269

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
Adam Ratzman (adamint) and others added 2 commits August 31, 2026 16:00
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19832

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19832"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review tier: Balanced
Findings: None

What changed in this PR

Bounds AppHost auxiliary backchannel handshakes to prevent CLI commands hanging on unresponsive AppHosts.

Changes:

  • Adds a shared 10-second handshake deadline.
  • Disposes failed JSON-RPC connections and observes deferred faults.
  • Tests timeout and disconnection for both handshake RPCs.
File Description
src/​Aspire.Cli/​Backchannel/​AppHostAuxiliaryBackchannel.cs Enforces and cleans up timed-out handshakes.
tests/​Aspire.Cli.Tests/​Backchannel/​AppHostAuxiliaryBackchannelTests.cs Covers stalled handshake methods and connection disposal.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed the bounded auxiliary-backchannel handshake, including cancellation, timeout enforcement, failure cleanup, both caller paths, and regression coverage. I didn’t find any issues to call out.

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

Labels

3 participants