Skip to content

fix(vscode): cap and chunk file search initialization to prevent event loop starvation (#13249) - #13271

Open
maoxin1234 wants to merge 1 commit into
continuedev:mainfrom
maoxin1234:fix/filesearch-unbounded-walk-cap
Open

maoxin1234 wants to merge 1 commit into
continuedev:mainfrom
maoxin1234:fix/filesearch-unbounded-walk-cap

Conversation

@maoxin1234

Copy link
Copy Markdown

Description

Fixes #13249.

On large or Remote-SSH workspaces, \FileSearch.initializeFileSearchState()\ previously walked and indexed every file into MiniSearch in a single synchronous call with no cap. This blocked the Node.js event loop in the extension host for dozens of seconds, leading to connection timeouts and renderer crashes on remote workspaces.

Changes

  1. Added \MAX_FILE_SEARCH_FILES = 50_000\ cap to prevent unbounded in-memory index growth.
  2. Added \FILE_SEARCH_BATCH_SIZE = 1_000\ chunking to \initializeFileSearchState().
  3. Yielded to the event loop (\�wait new Promise((resolve) => setTimeout(resolve, 0))) between batches so the extension host and remote connection handlers stay responsive.

Test Plan

  • Verified source builds and unit tests pass.

@maoxin1234
maoxin1234 requested a review from a team as a code owner September 13, 2026 13:24
@maoxin1234
maoxin1234 requested review from sestinj and removed request for a team September 13, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileSearch.initializeFileSearchState() walks and indexes the entire workspace unbounded — kills the renderer on Remote-SSH

1 participant