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

Abierto
#1,902 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript, vscode

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)

Lenguaje dominante
TypeScript
Estrellas
117
Forks
59
Merge medio
2 d 8 min
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de intersystems-community/vscode-objectscript

Todos los issues de intersystems-community/vscode-objectscript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.