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

未关闭
#1,902 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 分钟
30 天内合并 PR
11

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

intersystems-community/vscode-objectscript 的其他 Issue

查看 intersystems-community/vscode-objectscript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。