Skip to content

fix(gradle): Avoid ConcurrentModificationException in init script#11589

Draft
Juli0q wants to merge 1 commit intooss-review-toolkit:mainfrom
boschglobal:fix/gradle-concurrent-modification
Draft

fix(gradle): Avoid ConcurrentModificationException in init script#11589
Juli0q wants to merge 1 commit intooss-review-toolkit:mainfrom
boschglobal:fix/gradle-concurrent-modification

Conversation

@Juli0q
Copy link
Contributor

@Juli0q Juli0q commented Mar 20, 2026

Take snapshots of project.configurations and project.repositories with .toList() before iterating over them. These are live Gradle collections, and dependency resolution can trigger changes to them while the model is built, causing a ConcurrentModificationException with Gradle 9.3.1.

I've tested with the existing Gradle version functional tests. The test passed and covers all supported Gradle versions, including Gradle 9.3.1.

Take snapshots of `project.configurations` and `project.repositories`
with `.toList()` before iterating over them. These are live Gradle
collections, and dependency resolution can trigger changes to them while
the model is built, causing a ConcurrentModificationException with
Gradle 9.3.1.

Signed-off-by: Julian Olderdissen <julian.olderdissen@bosch.com>
@Juli0q Juli0q force-pushed the fix/gradle-concurrent-modification branch from 8494857 to 81a59c2 Compare March 20, 2026 13:32
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.99%. Comparing base (eb7eae2) to head (81a59c2).
⚠️ Report is 47 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11589      +/-   ##
============================================
+ Coverage     58.38%   58.99%   +0.61%     
- Complexity     1753     1799      +46     
============================================
  Files           355      355              
  Lines         13210    13416     +206     
  Branches       1313     1368      +55     
============================================
+ Hits           7712     7915     +203     
+ Misses         5008     5005       -3     
- Partials        490      496       +6     
Flag Coverage Δ
funTest-external-tools 14.56% <ø> (-0.02%) ⬇️
funTest-no-external-tools 30.63% <ø> (+0.05%) ⬆️
test-ubuntu-24.04 42.44% <ø> (+0.03%) ⬆️
test-windows-2025 42.42% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

List<OrtConfiguration> configurations = project.configurations.findResults { configuration ->
List<OrtConfiguration> configurations = project.configurations.toList().findResults { configuration ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit-message: Can you describe how frequent (percentage) the issues reproduces? Also, is this really preventing it, or is just the likelyhood reduced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants