redhat-developer / redhat-developer/vscode-java

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

Abierto
#4,043 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Gradle
Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
546
Merge medio
20 h 1 min
PR fusionados (30 d)
11

Descripción

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.

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Comienza con com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath y GradleBuildServerProjectImporter.importProjects; después inspecciona el stack de inicialización indicado y reproduce el problema con la compilación grande de Gradle con múltiples proyectos. El issue estará completo cuando la importación ya no falle con ConcurrentModificationException y la salida relevante de Java/Gradle confirme una inicialización correcta del proyecto.

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

Evaluación

Stack tecnológico
java
Área
build-system, developer-experience, devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.