Skip to content

Avoid async IPC panic on peer close - #64142

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fix-async-ipc-peer-close
Open

Avoid async IPC panic on peer close#64142
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fix-async-ipc-peer-close

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Copilot AI balanced review requested due to automatic review settings September 3, 2026 04:35
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 3, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 3, 2026

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.

🟡 Changes recommended

The critical unbounded teardown wait must be fixed and covered by a regression test.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Prevents async IPC response-write panics after peer closure, but introduces potentially indefinite teardown blocking.

Changes:

  • Propagates response-write failures through Run.
  • Adds a peer-close regression test.
File summaries
File Description
tsc/internal/ipc/conn_async.go Tracks handlers, but synchronously waiting can block teardown indefinitely.
tsc/internal/ipc/conn_async_test.go Tests peer closure, but does not cover a handler remaining blocked.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

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

Comment thread tsc/internal/ipc/conn_async.go

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.

🟡 Changes recommended

The terminal error must include the request-handler failure before pending calls are closed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread tsc/internal/ipc/conn_async.go

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.

🟢 Approval recommended

The peer-close race is handled safely and covered by regression tests.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

🟡 Changes recommended

Preserve existing panic checks with targeted recovery and prevent duplicate, unbounded terminal-error accumulation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread tsc/internal/ipc/conn_async.go Outdated
Comment thread tsc/internal/ipc/conn_async.go Outdated
@jakebailey

Copy link
Copy Markdown
Member Author

Funny how clicking review twice gets "no problems" then "two problems"

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.

🟢 Approval recommended

The reviewed changes have no unresolved approval-blocking issues.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

🔵 Needs a closer look

Preserve fail-fast response-write invariants while containing peer-close failures.

Review details

Suppressed comments (1)

tsc/internal/ipc/conn_async.go:104

  • This replaces the existing fail-fast response-write checks with ordinary returned errors, while SyncConn still treats the same failures as invariant violations (tsc/internal/ipc/conn_sync.go:92-105,130-156). Preserve those checks while containing the peer-close case—for example, recover a dedicated response-write panic at this goroutine boundary and re-panic unrelated values—instead of changing handleRequest's failure contract.
				if requestErr := c.handleRequest(handlerCtx, msg); requestErr != nil {
					if c.recordRequestError(requestErr, requestErrors) {
						if c.rwc != nil {
							_ = c.rwc.Close()
						}
					}
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Return response write failures through sync and async connections instead
of panicking while handling requests.

Preserve the first async terminal cause, unblock pending calls, and close
the transport once while retaining handler teardown ordering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants