Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-2957

finalizedBy may cause IndexOutOfBundsException

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2-rc-1

      Description

      Some legal combination of finalizedBy and dependsOn may cause following exception:

      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.onOrderingCycle(DefaultTaskExecutionPlan.java:255)
      	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.determineExecutionPlan(DefaultTaskExecutionPlan.java:211)
      	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.ensurePopulated(DefaultTaskGraphExecuter.java:148)
      	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:82)
      	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
      	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
      	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
      	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
      	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
      	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
      	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
      	at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
      	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
      	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
      	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
      	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
      	at org.gradle.util.Swapper.swap(Swapper.java:38)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
      	at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
      	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:36)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
      	at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
      	at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
      	at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
      	at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
      	at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
      

      I can repro this but it's really tangled and I don't have a small repro sample to attach.

        Issue Links

          Activity

          Hide
          dcoraboeuf Damien Coraboeuf added a comment - - edited

          When debugging the test, I saw that taskTwo and taskOne were considered must successors to the finalTask. It looks a bit strange to me. Any idea?

          It seems to me that this should be the other way round, that a finalizer should be considered a successor of the finalized task in the graph, and not the other way round.

          Show
          dcoraboeuf Damien Coraboeuf added a comment - - edited When debugging the test, I saw that taskTwo and taskOne were considered must successors to the finalTask . It looks a bit strange to me. Any idea? It seems to me that this should be the other way round, that a finalizer should be considered a successor of the finalized task in the graph, and not the other way round.
          Hide
          szczepiq Szczepan Faber added a comment -

          Nice debugging! You seem to be close to get it fixed I look into this problem when I have some spare cycles. In meantime, we would love a PR from you

          Show
          szczepiq Szczepan Faber added a comment - Nice debugging! You seem to be close to get it fixed I look into this problem when I have some spare cycles. In meantime, we would love a PR from you
          Hide
          dcoraboeuf Damien Coraboeuf added a comment -

          Coming soon...

          Show
          dcoraboeuf Damien Coraboeuf added a comment - Coming soon...
          Hide
          dcoraboeuf Damien Coraboeuf added a comment -

          PR at https://github.com/gradle/gradle/pull/333

          I was able:

          1. to design a test that reproduces the issue
          2. to fix the issue by ignoring faulty cycle detections

          Damien.

          Show
          dcoraboeuf Damien Coraboeuf added a comment - PR at https://github.com/gradle/gradle/pull/333 I was able: to design a test that reproduces the issue to fix the issue by ignoring faulty cycle detections Damien.
          Hide
          szczepiq Szczepan Faber added a comment -

          Thanks so much! We'll look into the PR.

          Show
          szczepiq Szczepan Faber added a comment - Thanks so much! We'll look into the PR.

            People

            • Assignee:
              erdi Marcin Erdmann
              Reporter:
              szczepiq Szczepan Faber
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development