redhat-developer / redhat-developer/vscode-java

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

オープン
#4,043 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Gradle
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath と GradleBuildServerProjectImporter.importProjects から始め、次に報告された初期化スタックを調査し、大規模な複数プロジェクト Gradle ビルドで再現します。インポートが ConcurrentModificationException で失敗しなくなり、関連する Java/Gradle 出力でプロジェクトの初期化が成功したことを確認できれば、issue は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
build-system, developer-experience, devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。