Skip to content

Reject pending async API requests when the connection closes - #65088

Open
ShiJie Wu (wsjwu58-cmd) wants to merge 1 commit into
microsoft:mainfrom
wsjwu58-cmd:fix/async-api-disconnect
Open

ShiJie Wu (wsjwu58-cmd) wants to merge 1 commit into
microsoft:mainfrom
wsjwu58-cmd:fix/async-api-disconnect

Conversation

@wsjwu58-cmd

@wsjwu58-cmd ShiJie Wu (wsjwu58-cmd) commented Nov 1, 2026 •

Copy link
Copy Markdown

Fixes #65089

Analysis

When the async API server disconnects during a request, vscode-jsonrpc closes the connection without rejecting pending responses. Callers can remain blocked until they explicitly close the API. Disposing immediately also risks dropping complete responses still waiting for decoding or dispatch.

Fix

Handle disconnects for socket and spawned-process clients, reject queued work, drain complete responses received before the first close event, then reject unanswered requests. Keep stale connection closures from affecting retries and wait for drained response timings before writing a timing dump.

After a writer-only close, bytes not yet delivered to the reader are discarded so an independently open reader cannot keep requests pending indefinitely. No dependencies or vendored files change.

Validation

  • 28 new disconnect regression tests passed.
  • Full native API suite: 1048 passed.
  • WASM API suites: 381 async and 533 sync passed.
  • Type builds, both Go lint modules (0 issues), and formatting passed.

Copilot Checklist

  • npx hereby validate --api completed without error. The command exited 1 because Go tests hit Windows paging-file/memory limits, missing symlink privileges, and an fswatch event mismatch. The three memory-related failed packages passed when rerun separately; all API suites passed.
  • New tests cover the change.
  • Associated issue in the Backlog milestone. Issue Async API requests remain pending after the RPC connection closes #65089 has been filed and is awaiting milestone triage.

Related: #64846 handles the same underlying mechanism only during timing collection on explicit close.

AI assistance

The implementation and tests were authored with Codex using Terra max sub-agents and reviewed with AI assistance. The human operator selected this specific fix. Human code review remains pending.

@wsjwu58-cmd

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@wsjwu58-cmd
ShiJie Wu (wsjwu58-cmd) marked this pull request as ready for review November 1, 2026 11:14
Copilot AI balanced review requested due to automatic review settings November 1, 2026 11:14

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

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

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

2 participants