Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memory
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript, vscode
- Área
- tooling
Línea de trabajo
El bucle está en vscode/src/dependenciesTree.ts: getParent (alrededor de la línea 55) sube hasta llegar a la raíz de la ruta, y activeEditorDidChange (alrededor de la línea 92) revela la URI de cualquier editor activo sin importar el scheme, por lo que los documentos untitled se recorren indefinidamente. Empieza leyendo esas dos funciones y treeVisibilityDidChange, que además revela el currentVisibleItem recordado. Está terminado cuando activar un editor untitled ya no dispara un reveal ni un recorrido de padres, y getParent devuelve undefined para una ruta padre que no es absoluta o que no avanza.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Ruby LSP Information
VS Code Version
1.141.0
Ruby LSP Extension Version
0.10.6
Ruby LSP Server Version
0.26.11
Ruby LSP Add-ons
- Ruby LSP Rails (0.4.8)
- RuboCop (1.86.1)
Ruby Version
3.4.7
Ruby Version Manager
mise
Installed Extensions
Click to expand
- bruno (6.0.0)
- claude-code (2.1.296)
- gitlab-workflow (7.2.0)
- ruby-extensions-pack (0.1.14)
- ruby-lsp (0.10.6)
- sorbet-vscode-extension (0.3.47)
- sql-developer (26.3.0)
- vscode-yaml (1.25.0)
Ruby LSP Settings
Click to expand
Workspace
{}
User
{
"enabledFeatures": {
"codeActions": true,
"diagnostics": true,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": true,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"completion": false,
"codeLens": true,
"definition": true,
"workspaceSymbol": true,
"signatureHelp": true,
"typeHierarchy": true
},
"featuresConfiguration": {},
"addonSettings": {},
"rubyVersionManager": {
"identifier": "auto"
},
"customRubyCommand": "",
"formatter": "rubocop_internal",
"linters": [
"rubocop_internal"
],
"bundleGemfile": "",
"testTimeout": 30,
"pullDiagnosticsOn": "both",
"useBundlerCompose": false,
"bypassTypechecker": false,
"rubyExecutablePath": "sh",
"indexing": {},
"erbSupport": true,
"featureFlags": {},
"sigOpacityLevel": "1"
}
Also: Remote – Dev Containers on linux-arm64 (Apple Silicon host), explorer.autoReveal left at its default (true). All versions above are the latest stable releases, and the same code is still on main.
Reproduction steps
- Start the Ruby LSP in VS Code by opening a Rails project.
- In the Explorer, expand the Dependencies view so its contents are visible.
- Create an untitled document with File → New Text File (
Untitled-N). - Click a saved file, then click back to the untitled tab.
- The extension host's memory starts climbing straight away (591 MB → 1.46 GB in about 20 seconds) until V8 aborts it with
JavaScript heap out of memory. The VS Code window hangs in the meantime.
No other extensions are needed. We first hit this through Oracle SQL Developer worksheets, which are also untitled documents.
It also triggers if an untitled editor is active while the Dependencies view is hidden and you then show the view, because currentVisibleItem is remembered and revealed in treeVisibilityDidChange.
Expected: nothing happens, because an untitled document can't be part of any gem.
Code snippet or error message
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Extension Host Process exited with code: null, signal: SIGABRT.
Heap-allocation profile of the extension host while memory was growing:
-- live allocations by extension
65.3% (vscode core)
34.3% shopify.ruby-lsp
-- top allocating functions
49.0% (vscode core) :: r extensionHostProcess.js:28
34.1% shopify.ruby-lsp :: getParent extension.js:79
15.5% (vscode core) :: (anon) extensionHostProcess.js:294
0.3% (vscode core) :: _resolveParent extensionHostProcess.js:294
0.3% (vscode core) :: joinPath extensionHostProcess.js:28
The cause seems to be in vscode/src/dependenciesTree.ts. activeEditorDidChange (line 92) wraps any active editor's URI in a GemFilePath and reveals it, whatever its scheme. TreeView.reveal then calls getParent (line 55) until it returns undefined, and getParent only stops when parentUri.path === path.parse(parentUri.path).root:
getParent(element: BundlerTreeNode): vscode.ProviderResult<BundlerTreeNode> {
const parentUri = vscode.Uri.joinPath(element.resourceUri, "..");
const rootPath = path.parse(parentUri.path).root;
if (parentUri.path === rootPath) {
return undefined;
}
// ...otherwise returns a gem root or a new GemDirectoryPath(parentUri)
}
For a file: URI the walk ends at /. An untitled document's path has no leading /, so rootPath is "", and joining .. never produces "":
/workspaces/app/db/x.sql -> /workspaces/app/db -> /workspaces/app -> /workspaces -> / (stops)
Untitled-2 -> . -> .. -> ../.. -> ../../.. -> ../../../.. -> ... (never stops)
(The trace comes from running the same check with path.posix.join in Node. The profile above matches it.)
Possible fix: skip non-file: URIs in activeEditorDidChange, ideally only revealing URIs under one of gemRootFolders. As a safety net, getParent could return undefined when the parent path isn't absolute or equals the current path:
const uri = editor?.document.uri;
if (!uri || uri.scheme !== "file") {
return;
}
Workaround: hide the Dependencies view, or set "explorer.autoReveal": false.
- Lenguaje dominante
- Ruby
- Estrellas
- 2k
- Forks
- 283
- Merge medio
- 9 h 18 min
- PR fusionados (30 d)
- 11
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Shopify/ruby-lsp
-
Linux file system with square brackets in the directory/filename are failing to be indexedPosiblemente ocupada @andriytyurnikov la tomó hace 212 días. Abiertobug help-wanted pinned
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Shopify/ruby-lsp#3503 · 8 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
rbenv activation leaks RBENV_VERSION and RBENV_DIR into process.env of the extension hostPosiblemente ocupada @efegokdemir la tomó hace 2 días. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Rename of a class moves its file and leaves require_relative on the old pathPosiblemente ocupada @efegokdemir la tomó hace 9 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
-
Paths need to be escapedPosiblemente ocupada @Vraiment la tomó hace 13 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
check-labels intermittently fails due to the organization IP allow listPosiblemente ocupada @soutaro la tomó hace 16 días. Abierto
Shopify/ruby-lsp#4219 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Shopify/ruby-lsp
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
thewca/worldcubeassociation.org#16088 ·
Los mantenedores suelen responder en 1 día
-
cocoapods: bundled activesupport raises `unknown keyword: quirks_mode` once json 3 is installedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Homebrew/homebrew-core#319232 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día