Avoid async IPC panic on peer close - #64142
Conversation
There was a problem hiding this comment.
🟡 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.
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
🟡 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
|
Funny how clicking review twice gets "no problems" then "two problems" |
8304447 to
1ce8edb
Compare
1ce8edb to
5793e46
Compare
There was a problem hiding this comment.
🔵 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
SyncConnstill 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 changinghandleRequest'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.
5793e46 to
89600d9
Compare
This tries to fix the race condition hit in CI: https://github.com/microsoft/TypeScript/actions/runs/33681309624/job/100418285983