microsoft / microsoft/vscode-java-dependency
Memory exception when using java.getPackageData and more
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 199
- Forks
- 105
- Merge moyen
- 1 j 22 h
- PR mergées (30 j)
- 27
Description
Hello! I am developing a VS Code extension for the static analysis of Java code. My extension is based on your extension where I have found a couple of useful commands.
However, while working with them, I ran into a few issues. One of them is critical to me, so let me start there.
- When working with large projects, calling the java.GetPackageData command causes hangs and memory leaks.
This is how I use the command:
Since not all project source files are always located in the project root directory, I use the command to get a list of paths to all elements with kind = "PackageRoot" of the project. Then I recursively get all sources (.java) from them.
In the same way, I get paths to all dependencies (.jar) of the project. I use the command to traverse all elements with kind = "Container" and get the paths to the dependencies.
The issue:
When working with a large project —in my case, this one (https://github.com/elastic/elasticsearch/releases/tag/v8.11.2) — calling the command to get the "PackageRoot" list of a single project module leads to hangs and very high RAM consumption. This causes memory exception to be thrown or the VS Code to crash.
Here is the example of a command call that causes the issue:
vscode.commands.executeCommand("java.execute.workspaceCommand", "java.GetPackageData", {kind: 2, projectUri: "file:///d%3A/Java_projects/el2/elasticsearch-8.11.2/benchmarks/");
- The "java.project.getAll" and "java.project.list" commands sometimes return different numbers of elements. Although, the only difference between the two seems to be that "java.project.getAll" returns a list of "uri" projects, while "java.project.list" returns a list of INodeData objects.
The "java.project.getAll" command sometimes returns fewer elements than "java.project.list", even though it seems like it should return the uri of all projects in the directory.
I also noticed the following differences between these commands:
- "java.project.getAll" identifies the uri of projects included via the settings.gradle file, while "java.project.list" does not. An example of including projects in the settings.gradle file:
include 'common', 'warnings'
project(':common').projectDir = new File("../../pvsjava/common")
project(':warnings').projectDir = new File("../../pvsjava/warnings")
- The "java.GetPackageData" command does not work with modules that are defined by the "java.project.list" command, but are not defined by the "java.project.getAll" command.
I would appreciate it if you could help me with the first issue. However, if you could make the "java.project.getAll" command return uri of all projects in the opened directory, and at the same time make it possible to work with these projects using the "java.GetPackageData" command, that would be great!
It would also be nice to have
a command enabling you to identify projects that contain a particular source file (.java) or directory.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire l’appel java.GetPackageData sur le grand projet référencé, puis lisez les implémentations ou les points d’entrée de java.GetPackageData, java.project.getAll et java.project.list. L’issue couvre l’utilisation de la mémoire, la découverte des projets et la recherche de fichiers source ; sa résolution nécessiterait de définir un périmètre convenu et de vérifier que les commandes sélectionnées ne se bloquent plus ou ne plantent plus, et renvoient des informations cohérentes sur le projet.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, typescript, vscode
- Domaine
- developer-experience, tooling
- Type d'issue
- Bug
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100