Extension host freezes for a long time on startup in large client-side workspaces (workspace indexing queues every file)

オープン
#1,902 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript, vscode

調査の方向性

Start with src/utils/documentIndex.ts at indexWorkspaceFolder and src/utils/index.ts at Semaphore.release; the issue links to the relevant lines. Trace how workspace files are discovered and queued, then inspect how importability checks handle non-ObjectScript files. Reproduce with a large workspace and compare startup responsiveness; done means indexing no longer causes a long extension host freeze.

索引モデルが issue の本文から書いたものです。

説明

Description

In a project workspace folder with about 300,000 files, of which only a small part are ObjectScript classes and routines, the extension host becomes unresponsive for more than a minute after every start or window reload. During that time no completions or hovers work for any extension. VS Code attributes the freeze to vscode-objectscript extension (about 90% of the sampled time):

[info]    [Window] Extension host (LocalProcess pid: 27936) is unresponsive.
[warning] [Window] UNRESPONSIVE extension host: 'intersystems-community.vscode-objectscript' took 90.05% of 4508.89ms
[info]    [Window] Extension host (LocalProcess pid: 27936) is responsive.   <- ~65s later
Cause (v3.8.7, same on master)
  1. indexWorkspaceFolder (documentIndex.ts#L192) runs findFiles("{**/*}") and queues one rate-limited task per file. That is hundreds of thousands of tasks.
  2. Semaphore.release() (index.ts#L1185) dequeues with Array.prototype.shift(), which is O(n) on an array this large. Draining the queue is therefore O(n²), and most of the CPU time goes into release.
  3. Every task, including those for non-ObjectScript files, calls isImportableLocalFile. Through cspAppsForUri and otherDocExtsForUri that constructs two AtelierAPI objects and reads the configuration, once per file.

I made sure that excluding the non-ObjectScript code folders via files.exclude removes the freeze.

Suggestions for improving behavior
  • Is it possible to filter files by extension before queueing, or pass a narrower glob to findFiles?
  • Alternatively, adding a setting to the extension that allows for listing project subdirectories containing ObjectScript code (or, conversely, those that do not contain ObjectScript code) might also help solve the problem.
Environment

vscode-objectscript 3.8.7, VS Code 1.145.2, Windows 11

(actually, the problem existed in earlier versions as well, I’ve only now managed to figure out what was going on)

主要言語
TypeScript
スター
117
フォーク
59
平均マージ
2日 8分
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

intersystems-community/vscode-objectscript のほかの issue

intersystems-community/vscode-objectscript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。