Skip to content

Enforce exclusive checker acquisition - #64543

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:fix-checker-request-ownership
Sep 29, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:fix-checker-request-ownership

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This is a replacement for #64513.

I think it's probably not worth trying to be clever about allowing checker reuse reentrancy through request chains; as seen in the linked PR and crashes, it's easy to get into situations where the checker becomes concurrently used or mismanaged.

Dropping this is in some ways a simplification, but is generally a noop, because often the context was being passed just to eventually ask for a checker anyway. We can still reuse checkers we previously released if they're there.

Closes #64513

Request identity does not imply exclusive ownership: parallel workers
inherit their parent's request ID and can otherwise mutate the same
checker concurrently. Request affinity must only select idle checkers,
not bypass acquisition.

Nested language-service operations must share an explicitly acquired
checker or finish their acquisition before the next operation. This
keeps ownership independent of context propagation and avoids requiring
parallel compiler operations to strip request metadata.

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

🔵 Needs a closer look

The central checker-pool concurrency contract warrants final human review despite focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Enforces exclusive checker acquisition while preserving released-checker affinity and removes nested acquisitions in language-service paths.

Changes:

  • Prevents request IDs from bypassing checker exclusivity.
  • Reuses acquired checkers or releases them before nested operations.
  • Adds checker contention, diagnostics, and content-mapper regressions.
File Description
tsc/​internal/​compiler/​checkerpool.go Documents exclusive, non-reentrant acquisition.
tsc/​internal/​project/​checkerpool.go Enforces semaphore acquisition for every checkout.
tsc/​internal/​project/​checkerpool_test.go Tests affinity and same-request contention.
tsc/​internal/​lsp/​server_flakydiagnostics_test.go Covers parallel diagnostic/emit behavior.
tsc/​internal/​ls/​inlay_hints.go Releases each mapped-range checker promptly.
tsc/​internal/​ls/​findallreferences.go Passes the existing checker into nested reference logic.
tsc/​internal/​ls/​codeactions_importfixes.go Shares one checker across import-fix processing.
tsc/​internal/​ls/​codeactions_fixmissingtypeannotation.go Collects diagnostics before acquiring the fixer checker.
tsc/​internal/​ls/​codeactions_fixclassincorrectlyimplementsinterface.go Avoids diagnostic collection while holding a checker.
tsc/​internal/​fourslash/​tests/​contentMapperInlayHints_test.go Adds mapped-range checker-release coverage.
tsc/​testdata/​baselines/​reference/​fourslash/​inlayHints/​contentMapperInlayHintsReleaseEachRange.baseline Records expected inlay hints.

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

@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Sep 29, 2026
Merged via the queue into microsoft:main with commit b85298b Sep 29, 2026
29 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the fix-checker-request-ownership branch September 29, 2026 23:13
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: Done

Development

Successfully merging this pull request may close these issues.

3 participants