ktlint-gradle
ktlint-gradle copied to clipboard
ConcurrentModificationException in LoadReportersWorkAction
Sometime but not always we get a ConcurrentModificationException from this gradle plugin when it is in the LoadReportersWorkAction.
We have several kotlin modules (mixed with java modules) and the ktLint check runs there in parallel. We run the task ktlintCheck. Each module configures ktLint with the CHECKSTYLE reporter like this:
ktlint {
reporters {
reporter(ReporterType.CHECKSTYLE)
}
}
We are using v10.1.0.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':loadKtlintReporters'.
A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.LoadReportersWorkAction
Could not serialize unit of work.
java.util.ConcurrentModificationException (no error message)
is this a plugin problem or should we configure the reporters in a different manner?
I think it is a bug in plugin. Could you provide full stacktrace and how many subprojects do you have in your project?
We have 15 Kotlin subprojects in the build. In each ktLint is enabled. (There are about 60 more java subprojects.) Since the ConcurrentModificationException only happens rarely (about every 50th to 100th build) I don't have a full stacktrace at hand. But will try to provide one next time.
Hi, our team ran into this same issue. We have 71 subprojects and we run ktlint on all of them. Our CI performs 10s of builds daily and as far as I'm aware this is the first and only time we ran into this issue. We do not configure the reporter. This error occurred with version 10.1.0 of the plugin. Find the stack trace attached below.
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
version = "0.40.0"
android = true
}
}
Stack trace
* What went wrong:
Execution failed for task ':feedback:loadKtlintReporters'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.LoadReportersWorkAction
> Could not serialize unit of work.
> java.util.ConcurrentModificationException (no error message)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':feedback:loadKtlintReporters'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:186)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.LoadReportersWorkAction
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:208)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:214)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: org.gradle.workers.internal.WorkSerializationException: Could not serialize unit of work.
at org.gradle.workers.internal.DefaultActionExecutionSpecFactory.serialize(DefaultActionExecutionSpecFactory.java:79)
at org.gradle.workers.internal.DefaultActionExecutionSpecFactory.newTransportableSpec(DefaultActionExecutionSpecFactory.java:42)
at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.lambda$execute$0(IsolatedClassloaderWorkerFactory.java:51)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.execute(IsolatedClassloaderWorkerFactory.java:49)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:206)
... 6 more
Caused by: java.util.ConcurrentModificationException
at org.gradle.internal.serialize.DefaultSerializerRegistry.build(DefaultSerializerRegistry.java:84)
at org.gradle.workers.internal.IsolatableSerializerRegistry.writeIsolatable(IsolatableSerializerRegistry.java:129)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedManagedValueSerializer.write(IsolatableSerializerRegistry.java:345)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedManagedValueSerializer.write(IsolatableSerializerRegistry.java:338)
at org.gradle.workers.internal.IsolatableSerializerRegistry.writeIsolatable(IsolatableSerializerRegistry.java:129)
at org.gradle.workers.internal.IsolatableSerializerRegistry.writeIsolatableSequence(IsolatableSerializerRegistry.java:142)
at org.gradle.workers.internal.IsolatableSerializerRegistry.access$2200(IsolatableSerializerRegistry.java:62)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedArraySerializer.write(IsolatableSerializerRegistry.java:515)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedArraySerializer.write(IsolatableSerializerRegistry.java:510)
at org.gradle.workers.internal.IsolatableSerializerRegistry.writeIsolatable(IsolatableSerializerRegistry.java:129)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedManagedValueSerializer.write(IsolatableSerializerRegistry.java:345)
at org.gradle.workers.internal.IsolatableSerializerRegistry$IsolatedManagedValueSerializer.write(IsolatableSerializerRegistry.java:338)
at org.gradle.workers.internal.IsolatableSerializerRegistry.writeIsolatable(IsolatableSerializerRegistry.java:129)
at org.gradle.workers.internal.DefaultActionExecutionSpecFactory.serialize(DefaultActionExecutionSpecFactory.java:76)
... 23 more
Seeing the same issue in 10.2.0
This stack trace doesn't seem to have our code anywhere in the stack, that seems to indicate that there is some bug in Gradle. I'd suggest opening a bug in Gradle with this stack trace and communicate that, although you're seeing this with our plugin, the exception is all inside of Gradle code.
Proposed fix: https://github.com/gradle/gradle/pull/19170
Idk if that will actually fix the issue, but it might.
Closing, as there has been no activity here since the upstream fix when into place