redhat-developer / redhat-developer/vscode-java

ConcurrentModificationException when importing large multi-project Gradle build (BSP/Java Build Server)

Ouverte
#4,043 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Gradle
Langage dominant
TypeScript
Étoiles
2.3k
Forks
546
Merge moyen
20 h 1 min
PR mergées (30 j)
11

Description

Describe the bug
When trying to import a large, multi-project Gradle build in VS Code with the latest Java and Gradle extensions, the import fails with a ConcurrentModificationException deep in the Java Build Server (BSP) integration. The error occurs even after updating to the latest extension versions, and after applying all recommended workarounds (including disabling the build server).

To Reproduce
Steps to reproduce the behavior:

  1. Open VS Code with the latest Java and Gradle extensions.
  2. Open the root folder of a large, multi-module Gradle project (with many subprojects and plugins).
  3. Wait for the Java project import to start.
  4. Observe the error in the Java/Gradle output panel.

[Error - 1:26:18 PM] 13 May 2025, 13:26:18 Initialization failed org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at java.base/java.util.concurrent.CompletableFuture.reportJoin(Unknown Source) at java.base/java.util.concurrent.CompletableFuture.join(Unknown Source) at com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath(Utils.java:47) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importProjects(GradleBuildServerProjectImporter.java:322) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importToWorkspace(GradleBuildServerProjectImporter.java:226) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:164) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:126) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:263) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

** Additional Info**:
VS code version: 1.100.0 (Universal)
Gradle extension version: 3.16.4
Project Manager for Java: 0.24.1
Extension Pack for Java: 0.29.0
Java version: 17.0.8-tem
Gradle version: 7.6

My project builds and runs fine from the command line (./gradlew tasks works).
I have already refactored my build scripts to avoid mutating sourceSets, tasks, or configurations after evaluation.
I have tried disabling the build server ("java.import.gradle.buildServer.enabled": false), but the error persists.
I have also tried importing only a minimal subset of subprojects, but the error still occurs with the full project.
I found this commit which fixes a similar issue in the Gradle extension, but my error is coming from the Java Build Server integration.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath et GradleBuildServerProjectImporter.importProjects, puis examinez la stack d'initialisation signalée et reproduisez le problème avec le grand build Gradle multi-projets. L'issue est terminée lorsque l'importation n'échoue plus avec ConcurrentModificationException et que la sortie Java/Gradle pertinente confirme la réussite de l'initialisation du projet.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
build-system, developer-experience, devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.