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

Đang mở
#1,902 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, vscode

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)

Ngôn ngữ chính
TypeScript
Star
117
Fork
59
Merge trung bình
2 ngày 8 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của intersystems-community/vscode-objectscript

Tất cả issue của intersystems-community/vscode-objectscript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.