fix: prevent ConcurrentModificationException in parallel configuration cache with lazily registered reports#1656
Conversation
…efore config-cache serialization; add regression test Issue1654 Agent-Logs-Url: https://github.com/spotbugs/spotbugs-gradle-plugin/sessions/8f84448b-8d84-422a-b1fc-3c6bd1ba15f8 Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
|
@copilot Test failed |
…asspath issue in Issue1654 Agent-Logs-Url: https://github.com/spotbugs/spotbugs-gradle-plugin/sessions/6bc05a78-61e7-4df6-96bd-3c5ad9680289 Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Fixed in e2294e4. The root Restructured the test to match the existing |
|
@copilot Issue1654 > reports.register() does not cause ConcurrentModificationException with parallel config cache FAILED |
… Issue1654 Agent-Logs-Url: https://github.com/spotbugs/spotbugs-gradle-plugin/sessions/d25c3b2f-f084-4ae8-b904-c16880e772f1 Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Fixed in 5dfb099. The |
|
@copilot Current errors, see Please fix |
… subprojects in Issue1654 Agent-Logs-Url: https://github.com/spotbugs/spotbugs-gradle-plugin/sessions/3d0f4e5b-a39a-4f04-a7f6-9eba822b1edf Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
... Fixed in 7d63111. The inner Gradle build was failing with Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|



With
org.gradle.configuration-cache.parallel=true, Gradle's parallel serializer iteratesDefaultNamedDomainObjectCollection.UnfilteredIndex.pendingMap(aLinkedHashMap) to write pending providers. Serializing a provider value triggers its realization, which removes the entry from the map mid-iteration →ConcurrentModificationException. This manifests in multi-project builds using theconfigureEach+register()pattern:Changes
SpotBugsTask.reports(Action)— replacereports.toList()withreports.matching { true }.toList(). The plaintoList()call routes throughDefaultDomainObjectCollection.iterator(), which walks only already-realized elements and never callsrealizePending(), leaving registered items inpendingMap.matching { }creates aFilteredElementSourcewhoseiterator()callsrealizePending()first, fully drainingpendingMapbefore any config-cache serializer touches the container.Issue1654.groovy— regression test: two-subproject build withconfigureEach { reports { register('xml') ... } }andorg.gradle.configuration-cache.parallel=true, asserting the cache is stored cleanly on the first run and reused on the second.