[GRADLE-2041] circular task dependency to 'self' is hard to diagnose Created: 11/Jan/12  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 1


 Description   

When the task incurs circular dependency on 'self' sometimes it is hard to diagnose why. Here's an example, where we don't declare any explicit task dependency but the implicit dependencies are wired behind the scenes and effectively we end up with a circular dependency:

def coolFiles = files('foo.txt') {
  builtBy { 'needsStuff' }
}

task needsStuff(type: Copy) {
  from coolFiles
  into 'stuff'
}

Above example is probably easy to analyse by somewhat experienced gradle user. However, the actual use case came from rather complicated plugins infrastructure and the users weren't able to figure out the problem. With my help (szczepiq) and an hourly pairing session we nailed that down.

It would be nice if gradle offered better reporting of the circular dependencies given that implicit dependencies (aka autowiring) is gradle's preferred way of reducing build automation complexities. If lots of implicit dependencies are in use simply reporting task A depends on task B seems not enough.

The original problem:


i.e. in milestone 3 the project builds fine, but when upgrading to m5 (or m6) the build stops with:

  • Exception is:
    16:06:21.824 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.CircularReferenceException: Circular dependency between tasks. Cycle includes [task ':<...>:cmdline', task ':<...>:cmdline'].
    16:06:21.824 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.fillDag(DefaultTaskGraphExecuter.java:121)
    16:06:21.824 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:71)
    16:06:21.824 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:57)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:43)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:53)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:55)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:43)
    16:06:21.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:53)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:34)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:43)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:36)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
    16:06:21.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
    16:06:21.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
    16:06:21.828 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
    16:06:21.829 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:24)

Incidentally the task is somehow circularly dependent on itself?

Any ideas appreciated.



 Comments   
Comment by Gradle Forums [ 11/Jan/12 ]

Hey Stefan,

It looks like the problem occurs regardless of the tasks you run. Can you confirm?

Comment by Gradle Forums [ 11/Jan/12 ]

Yes, actually running gradle tasks gives me a java.util.ConcurrentModificationException:

08:34:15.504 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] task ':tasks' is not up-to-date
08:34:15.505 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':tasks'.
08:34:15.506 [QUIET] [org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated]
08:34:15.506 [QUIET] [org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated] ------------------------------------------------------------
08:34:15.507 [QUIET] [org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated] All tasks runnable from root project
08:34:15.507 [QUIET] [org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated] ------------------------------------------------------------
08:34:15.508 [QUIET] [org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated]
08:34:15.703 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':tasks'
08:34:15.706 [ERROR] [org.gradle.BuildExceptionReporter]
08:34:15.707 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
08:34:15.707 [ERROR] [org.gradle.BuildExceptionReporter]
08:34:15.707 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
08:34:15.708 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':tasks'.
08:34:15.709 [ERROR] [org.gradle.BuildExceptionReporter] Cause: java.util.ConcurrentModificationException (no error message)
08:34:15.709 [ERROR] [org.gradle.BuildExceptionReporter]
08:34:15.710 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
08:34:15.710 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':tasks'.
08:34:15.710 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
08:34:15.710 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
08:34:15.711 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
08:34:15.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
08:34:15.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
08:34:15.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
08:34:15.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
08:34:15.712 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
08:34:15.713 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
08:34:15.714 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48)
08:34:15.715 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
08:34:15.716 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
08:34:15.716 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
08:34:15.716 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
08:34:15.716 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39)
08:34:15.716 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.util.ConcurrentModificationException
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.DefaultDomainObjectCollection$IteratorImpl.next(DefaultDomainObjectCollection.java:313)
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.GraphAggregator.group(GraphAggregator.java:33)
08:34:15.717 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.diagnostics.internal.SingleProjectTaskReportModel.build(SingleProjectTaskReportModel.java:61)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.diagnostics.TaskReportTask.generate(TaskReportTask.java:67)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.diagnostics.AbstractReportTask.generate(AbstractReportTask.java:67)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.diagnostics.TaskReportTask_Decorated.invokeMethod(Unknown Source)
08:34:15.718 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
08:34:15.719 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)
08:34:15.719 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)
08:34:15.719 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
08:34:15.719 [ERROR] [org.gradle.BuildExceptionReporter] ... 37 more

The other tasks I tried are:

  • test : gave circular task error
  • dependency : worked fine
  • clean : worked fine
  • build : gave circular task error
Comment by Gradle Forums [ 11/Jan/12 ]

I can add that milestone-6 has exactly the same issues.

Comment by Gradle Forums [ 11/Jan/12 ]

Can you provide a build that allows us to reproduce the problem(s)?

Comment by Gradle Forums [ 11/Jan/12 ]

Sure, I'll see what I can do.

Comment by Gradle Forums [ 11/Jan/12 ]

Um, I'm not exactly sure what's the easiest way to do this, however through using the debugger I have managed to find the case where the "tasks" task breaks:

1. Inside GraphAggregator.java there is this method:

public Result<N> group(Collection<? extends N> startNodes, Collection<? extends N> allNodes) {
Map<N, Set<N>> reachableByNode = new HashMap<N, Set<N>>();
Set<N> topLevelNodes = new LinkedHashSet<N>(allNodes);
for (N node : allNodes) {
Set<N> reachableNodes = graphWalker.add(node).findValues();
reachableByNode.put(node, reachableNodes);
topLevelNodes.removeAll(reachableNodes);
}
topLevelNodes.addAll(startNodes);
Map<N, Set<N>> nodes = new HashMap<N, Set<N>>();
for (N node : topLevelNodes) {
nodes.put(node, calculateReachableNodes(reachableByNode, node, topLevelNodes));
}
return new Result<N>(nodes, topLevelNodes);
}

The ConcurrentModificationException is thrown on one of the topLevelNodes.removeAll(reachableNodes); calls (Note: since gradle is single threaded, so the only way this exception would be thrown is by modifying some iterator while we are iterating).

2. Let me setup all the variables which lead to the exception being thrown:
allNodes is the following [task ':databus-bootstrap-client:databus-bootstrap-client-impl:assemble', task ':databus-bootstrap-client:databus-bootstrap-client-impl:build', task ':databus-bootstrap-client:databus-bootstrap-client-impl:buildDependents', task ':databus-bootstrap-client:databus-bootstrap-client-impl:buildNeeded', task ':databus-bootstrap-client:databus-bootstrap-client-impl:check', task ':databus-bootstrap-client:databus-bootstrap-client-impl:classes', task ':databus-bootstrap-client:databus-bootstrap-client-impl:clean', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanEclipse', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanEclipseClasspath', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanEclipseJdt', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanEclipseProject', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanIdea', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanIdeaModule', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanTest', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cobertura', task ':databus-bootstrap-client:databus-bootstrap-client-impl:coberturaXml', task ':databus-bootstrap-client:databus-bootstrap-client-impl:compileJava', task ':databus-bootstrap-client:databus-bootstrap-client-impl:compileTestJava', task ':databus-bootstrap-client:databus-bootstrap-client-impl:dependencyReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipse', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseClasspath', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseJdt', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseProject', task ':databus-bootstrap-client:databus-bootstrap-client-impl:findbugs', task ':databus-bootstrap-client:databus-bootstrap-client-impl:findbugs-text', task ':databus-bootstrap-client:databus-bootstrap-client-impl:idea', task ':databus-bootstrap-client:databus-bootstrap-client-impl:ideaModule', task ':databus-bootstrap-client:databus-bootstrap-client-impl:instrumentedJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:ivyForArchives', task ':databus-bootstrap-client:databus-bootstrap-client-impl:jar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:javadoc', task ':databus-bootstrap-client:databus-bootstrap-client-impl:javadocJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:processResources', task ':databus-bootstrap-client:databus-bootstrap-client-impl:processTestResources', task ':databus-bootstrap-client:databus-bootstrap-client-impl:projectReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:propertyReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:release', task ':databus-bootstrap-client:databus-bootstrap-client-impl:sourcesJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:taskReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:test', task ':databus-bootstrap-client:databus-bootstrap-client-impl:testClasses', task ':databus-bootstrap-client:databus-bootstrap-client-impl:upload', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadArchives', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadDefault', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadDocs', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadJavadoc', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadRuntime', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadSources', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadTestRuntime']

3. We can assume that the for loop iterates over the allNodes in the sequence provided.

4. Skipping ahead to the point where the N node = task ':databus-bootstrap-client:databus-bootstrap-client-impl:cobertura' we have the following reachableNodes = [task ':databus-bootstrap-client:databus-bootstrap-client-impl:instrumentedJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:coberturaXml', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanTest', task ':databus-bootstrap-client:databus-bootstrap-client-impl:test', task ':databus-bootstrap-client:databus-bootstrap-client-impl:testClasses', task ':databus-bootstrap-client:databus-bootstrap-client-impl:classes', task ':databus-bootstrap-client:databus-bootstrap-client-impl:processTestResources', task ':databus-bootstrap-client:databus-bootstrap-client-impl:compileTestJava', task ':databus-bootstrap-client:databus-bootstrap-client-impl:compileJava', task ':databus-bootstrap-client:databus-bootstrap-client-impl:processResources']
and the state of the topLevelNodes just before removeAll is called with the reachableNodes set above is :
topLevelNodes = [task ':databus-bootstrap-client:databus-bootstrap-client-impl:buildDependents', task ':databus-bootstrap-client:databus-bootstrap-client-impl:buildNeeded', task ':databus-bootstrap-client:databus-bootstrap-client-impl:clean', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanEclipse', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cleanIdea', task ':databus-bootstrap-client:databus-bootstrap-client-impl:cobertura', task ':databus-bootstrap-client:databus-bootstrap-client-impl:coberturaXml', task ':databus-bootstrap-client:databus-bootstrap-client-impl:dependencyReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipse', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseClasspath', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseJdt', task ':databus-bootstrap-client:databus-bootstrap-client-impl:eclipseProject', task ':databus-bootstrap-client:databus-bootstrap-client-impl:findbugs', task ':databus-bootstrap-client:databus-bootstrap-client-impl:findbugs-text', task ':databus-bootstrap-client:databus-bootstrap-client-impl:idea', task ':databus-bootstrap-client:databus-bootstrap-client-impl:ideaModule', task ':databus-bootstrap-client:databus-bootstrap-client-impl:ivyForArchives', task ':databus-bootstrap-client:databus-bootstrap-client-impl:javadoc', task ':databus-bootstrap-client:databus-bootstrap-client-impl:javadocJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:projectReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:propertyReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:release', task ':databus-bootstrap-client:databus-bootstrap-client-impl:sourcesJar', task ':databus-bootstrap-client:databus-bootstrap-client-impl:taskReport', task ':databus-bootstrap-client:databus-bootstrap-client-impl:upload', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadArchives', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadDefault', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadDocs', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadJavadoc', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadRuntime', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadSources', task ':databus-bootstrap-client:databus-bootstrap-client-impl:uploadTestRuntime']

5. So examining the *reachableNodes, **topLevelNodes* & *allNodes* variables, we see that the next value of *N node* would be :databus-bootstrap-client:databus-bootstrap-client-impl:coberturaXml. But it is also in *reachableNodes* and *topLevelNodes. So when we come to do a **removeAll* on *topLevelNodes, we expect *:databus-bootstrap-client:databus-bootstrap-client-impl:coberturaXml to be removed. However the way *topLevelNodes* is initialized, it causes some deeper iterator interference which modifies the iterator being used for the for loop and *thus the exception* .

6. Please advise.

Comment by Gradle Forums [ 11/Jan/12 ]

Thanks for the detailed analysis. It will certainly help us in our investigation.

Comment by Gradle Forums [ 11/Jan/12 ]

One minor correction: the exception is thrown by the for loop when it does to get the next item, not in the removeAll step. i.e. after the removeAll step and we go to the next iteration of the forloop (which does a iterator.next() call).

Comment by Gradle Forums [ 11/Jan/12 ]

Hey Stefan,

By reading the code I cannot figure out how come that exception can be thrown. topLevelNodes, reachableNodes can contain the same item and we still should be able to removeAll() without interfering.

Do you have that dev environment still set up? Can we pair on it remotely? If we cannot than I suggest to dig a bit into what is changed in the allNodes and when (e.g. eager breakpoint at all mutators or some more code analysis)

Comment by Gradle Forums [ 11/Jan/12 ]

The issue has been solved by removing the circular dependency. However, the problem with awkward reporting still persists, e.g. "Cycle includes [task '::cmdline', task '::cmdline']".

I'll push that to jira.

Comment by Gradle Forums [ 11/Jan/12 ]

Well it's the next thing that the for loop iterator would go over, and it's just been removed... But yeah I havent had a chance to debug it with the fix to see what's changed.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:11:11 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.