Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29413

Parallel with an empty map will run forever

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      Jenkins 1.618
      Workflow 1.8
    • Similar Issues:

      Description

      While experimenting with Workflow, I called the equivalent of

      parallel [:]
      

      This appears to have never terminated.

      Specifically, "Execute sub-workflows in parallel : Start" has been running for 14 hours now, with no child steps.

        Attachments

          Issue Links

            Activity

            Hide
            ceej Chris Hillery added a comment -

            Recommend increasing the priority, as this bug can render your Jenkins installation unusable and unrecoverable.

            I ran the following workflow:

            def nothing = [:]
            node

            { parallel nothing }

            and now there is a "build" consuming one executor on a slave. This build cannot be killed and survives Jenkins restarts. Even deleting the slave entirely cannot recover the situation. Nothing short of nuking JENKINS_HOME from orbit seems to get rid of it.

            Clearly this workflow is silly, but it would be pretty easy to do the equivalent accidentally if your Groovy script dynamically built up a set of blocks to run (like the "splitTests" demo in the documentation does). And the consequences currently are pretty dire.

            Show
            ceej Chris Hillery added a comment - Recommend increasing the priority, as this bug can render your Jenkins installation unusable and unrecoverable. I ran the following workflow: def nothing = [:] node { parallel nothing } and now there is a "build" consuming one executor on a slave. This build cannot be killed and survives Jenkins restarts. Even deleting the slave entirely cannot recover the situation. Nothing short of nuking JENKINS_HOME from orbit seems to get rid of it. Clearly this workflow is silly, but it would be pretty easy to do the equivalent accidentally if your Groovy script dynamically built up a set of blocks to run (like the "splitTests" demo in the documentation does). And the consequences currently are pretty dire.
            Hide
            ceej Chris Hillery added a comment -

            FYI the workaround on JENKINS-25550 (appending /doDelete to the build URL) doesn't work either. It removes the build in that the URL for the build returns 404, but the "part of foo" build is still consuming an executor on the slave.

            Show
            ceej Chris Hillery added a comment - FYI the workaround on JENKINS-25550 (appending /doDelete to the build URL) doesn't work either. It removes the build in that the URL for the build returns 404, but the "part of foo" build is still consuming an executor on the slave.
            Hide
            ceej Chris Hillery added a comment -

            Also FYI, even deleting the Workflow itself doesn't fix it. Executors still in use (although that at least cleared any queued runs).

            Show
            ceej Chris Hillery added a comment - Also FYI, even deleting the Workflow itself doesn't fix it. Executors still in use (although that at least cleared any queued runs).
            Hide
            ceej Chris Hillery added a comment -

            Ahh... deleting the Workflow job, and then stopping and starting Jenkins finally did the trick. All executors free, and the phantom slave is gone.

            (FYI I initially tried to use the <jenkins>/restart URL to restart Jenkins, and the Java process went into a 100% CPU busyloop. But killing it and restarting Jenkins finally put things right.)

            This is still a pretty severe consequence of a trivial bug in a workflow script.

            Show
            ceej Chris Hillery added a comment - Ahh... deleting the Workflow job, and then stopping and starting Jenkins finally did the trick. All executors free, and the phantom slave is gone. (FYI I initially tried to use the <jenkins>/restart URL to restart Jenkins, and the Java process went into a 100% CPU busyloop. But killing it and restarting Jenkins finally put things right.) This is still a pretty severe consequence of a trivial bug in a workflow script.
            Hide
            jglick Jesse Glick added a comment -

            You need to delete the build as mentioned in JENKINS-25550, then restart.

            Show
            jglick Jesse Glick added a comment - You need to delete the build as mentioned in JENKINS-25550 , then restart.
            Hide
            ceej Chris Hillery added a comment -

            Good to know the work-around, but IMHO at least this is still a significant bug as the consequences are severe and the work-around is pretty hidden.

            Show
            ceej Chris Hillery added a comment - Good to know the work-around, but IMHO at least this is still a significant bug as the consequences are severe and the work-around is pretty hidden.
            Hide
            jglick Jesse Glick added a comment -

            No argument there.

            Show
            jglick Jesse Glick added a comment - No argument there.
            Hide
            cruftex Jens Wilke added a comment -

            Although obvious for the Groovy hackers, the workaround is:

            def possiblyEmptyArray = ...
            if (possiblyEmptyArray) {
              parallel possiblyEmptyArray
            }
            
            Show
            cruftex Jens Wilke added a comment - Although obvious for the Groovy hackers, the workaround is: def possiblyEmptyArray = ... if (possiblyEmptyArray) { parallel possiblyEmptyArray }
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/1ecc56e967940fbc6047aa432d5d5e556670eca2
            Log:
            [FIXED JENKINS-29413]: hung build when running the parallel step with an empty map.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/1ecc56e967940fbc6047aa432d5d5e556670eca2 Log: [FIXED JENKINS-29413] : hung build when running the parallel step with an empty map.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java
            http://jenkins-ci.org/commit/workflow-plugin/85330f60060d84c9d4d5b05a2062e9fc97063a74
            Log:
            Merge pull request #265 from jglick/parallel-JENKINS-29413

            JENKINS-29413 Hung build when running the parallel step with an empty map

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/be558db587b9...85330f60060d

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java http://jenkins-ci.org/commit/workflow-plugin/85330f60060d84c9d4d5b05a2062e9fc97063a74 Log: Merge pull request #265 from jglick/parallel- JENKINS-29413 JENKINS-29413 Hung build when running the parallel step with an empty map Compare: https://github.com/jenkinsci/workflow-plugin/compare/be558db587b9...85330f60060d
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/bd606c258e887f8b7f9fa4bab9de0d008541d524
            Log:
            [FIXED JENKINS-29413]: hung build when running the parallel step with an empty map.
            Originally-Committed-As: 1ecc56e967940fbc6047aa432d5d5e556670eca2

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepExecution.java http://jenkins-ci.org/commit/workflow-cps-plugin/bd606c258e887f8b7f9fa4bab9de0d008541d524 Log: [FIXED JENKINS-29413] : hung build when running the parallel step with an empty map. Originally-Committed-As: 1ecc56e967940fbc6047aa432d5d5e556670eca2

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                p_hampson Paul "TBBle" Hampson
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: