Spotless Gradle 6.0.0 -> 6.0.2 ConcurrentModificationException bug for large parallel builds
See original GitHub issueIf you are submitting a bug, please include the following:
- summary of problem
- gradle or maven version
- spotless version
- operating system and version
- copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
- copy-paste the full content of any console errors emitted by
gradlew spotless[Apply/Check] --stacktrace
I am trying to update spotless from 5.x to 6.x and get the below exception. The project uses org.gradle.parallel=true
and throws this exception on a machine with 16 cores, presumably causing more parallelism than other machines may cause, so may be hard to repro locally. But hopefully based on the stack trace we can find a location to verify. Perhaps this should use ConcurrentHashMap / computeIfAbsent?
Executing the task individually succeeds, it is when executing on the whole project it fails probably due to sync issue
Gradle
: 7.3.1
spotless-gradle-plugin
: 6.0.2
OS: Amazon Linux 2 (AWS m5.4xlarge)
Repro: https://github.com/anuraaga/opentelemetry-java-instrumentation/tree/spotless-repro
Run ./gradlew spotlessApply
(may not repro on all machines). Many spotless tasks run and succeed but the error happens and fails the build
Spotless config:
You need to add a repository containing the '[com.google.googlejavaformat:google-java-format:1.12.0]' artifact in 'testing/agent-for-testing/build.gradle'.
E.g.: 'repositories { mavenCentral() }'
org.gradle.api.InvalidUserDataException: Cannot add a configuration with name 'spotless865452459' as a configuration with that name already exists.
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.assertCanAdd(DefaultNamedDomainObjectCollection.java:213)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:77)
at org.gradle.api.internal.AbstractValidatingNamedDomainObjectContainer.create(AbstractValidatingNamedDomainObjectContainer.java:47)
at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:56)
at com.diffplug.gradle.spotless.GradleProvisioner.lambda$forProject$1(GradleProvisioner.java:73)
at com.diffplug.gradle.spotless.GradleProvisioner$DedupingProvisioner.provisionWithTransitives(GradleProvisioner.java:61)
at com.diffplug.spotless.JarState.provisionWithTransitives(JarState.java:68)
at com.diffplug.spotless.JarState.from(JarState.java:57)
at com.diffplug.spotless.JarState.from(JarState.java:52)
at com.diffplug.spotless.java.GoogleJavaFormatStep$State.<init>(GoogleJavaFormatStep.java:139)
at com.diffplug.spotless.java.GoogleJavaFormatStep.lambda$create$1(GoogleJavaFormatStep.java:92)
at com.diffplug.spotless.FormatterStepImpl.calculateState(FormatterStepImpl.java:56)
at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
at com.diffplug.spotless.LazyForwardingEquality.toBytes(LazyForwardingEquality.java:85)
at com.diffplug.spotless.LazyForwardingEquality.hashCode(LazyForwardingEquality.java:102)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Hi @nedtwigg - thanks for the quick fix. I am trying 6.0.4, and while the error I had isn’t showing anymore I get a deprecation warning (which currently we have set to fail the build but for now can workaround by disabling it)
For the sake of keeping things organized, I’m gonna close this out and follow-up the warning at #1028