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

pipeline will hang use wait=true during call other job in a loop

    Details

    • Similar Issues:

      Description

      Following is pipeline code

       

      @NonCPS
      def fn(){
      def parallelArgs = [:]
      new File('/home/jenkins/workspace/test_post_for_pipeline').eachFile() {
      file ->
      if (file.getName().endsWith('.properties')) {
      parallelArgs["Run: $\{file.getName()}"] = {
      build job: 'test', wait: true, parameters: [string(name: 'IN_PARAM_1', value: file.getAbsolutePath()), string(name: 'IN_PARAM_2', value: '2'), string(name: 'IN_PARAM_3', value: '3')]

      }
      }
      }
      parallel(parallelArgs)
      }

      node('master'){
      fn()
      }

       

      Result: the build will hang forever. even downstream job test build done 
      Started by user
      Shuaibing Li
      Replayed
      [#121

      https://jenkins-c.lombardrisk.com/job/test_post_for_pipeline/121/]
      [Pipeline] node
      Running on
      Jenkins
      in /home/jenkins/workspace/test_post_for_pipeline
      [Pipeline] {
      [Pipeline] parallel
      [Pipeline] [Run: a.properties] { (Branch: Run: a.properties)
      [Pipeline] [Run: a.properties] build (Building test)
      [Run: a.properties] Scheduling project:
      [test
      https://jenkins-c.lombardrisk.com/job/test/]
      [Pipeline] [Run: b.properties] { (Branch: Run: b.properties)
      [Pipeline] [Run: a.properties] build (Building test)
      [Run: a.properties] Scheduling project:
      [test
      https://jenkins-c.lombardrisk.com/job/test/]
      [Run: a.properties] Starting building:
      test #313

        Attachments

          Activity

          Hide
          lsbwant lsb want added a comment -

          After I abort this build, I got following log:
          Started by user
          Shuaibing Li
          Replayed
          #121
          [Pipeline] node
          Running on
          Jenkins
          in /home/jenkins/workspace/test_post_for_pipeline
          [Pipeline] {
          [Pipeline] parallel
          [Pipeline] [Run: a.properties] { (Branch: Run: a.properties)
          [Pipeline] [Run: a.properties] build (Building test)
          [Run: a.properties] Scheduling project:
          test
          [Pipeline] [Run: b.properties] { (Branch: Run: b.properties)
          [Pipeline] [Run: a.properties] build (Building test)
          [Run: a.properties] Scheduling project:
          test
          [Run: a.properties] Starting building:
          test #313
          Aborted by
          Shuaibing Li
          [Pipeline] [Run: a.properties] }
          [Run: a.properties] Failed in branch Run: a.properties
          [Pipeline] [Run: b.properties] }
          [Run: b.properties] Failed in branch Run: b.properties
          [Pipeline] // parallel
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          [BFA] Scanning build for known causes...
          [BFA] No failure causes found
          [BFA] Done. 0s
          Finished: ABORTED
           

          Show
          lsbwant lsb want added a comment - After I abort this build, I got following log: Started by user Shuaibing Li Replayed #121 [Pipeline] node Running on Jenkins in /home/jenkins/workspace/test_post_for_pipeline [Pipeline] { [Pipeline] parallel [Pipeline] [Run: a.properties] { (Branch: Run: a.properties) [Pipeline] [Run: a.properties] build (Building test) [Run: a.properties] Scheduling project: test [Pipeline] [Run: b.properties] { (Branch: Run: b.properties) [Pipeline] [Run: a.properties] build (Building test) [Run: a.properties] Scheduling project: test [Run: a.properties] Starting building: test #313 Aborted by Shuaibing Li [Pipeline] [Run: a.properties] } [Run: a.properties] Failed in branch Run: a.properties [Pipeline] [Run: b.properties] } [Run: b.properties] Failed in branch Run: b.properties [Pipeline] // parallel [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline [BFA] Scanning build for known causes... [BFA] No failure causes found [BFA] Done. 0s Finished: ABORTED  
          Hide
          pfink Patrick Fink added a comment -

          I'm expieriencing the same issue on the following setup:

          • Jenkins 2.107
          • Java 1.8.0_102-b14
          • RHEL 7.3
          • also calling from a @NonCPS annotated method
          Show
          pfink Patrick Fink added a comment - I'm expieriencing the same issue on the following setup: Jenkins 2.107 Java 1.8.0_102-b14 RHEL 7.3 also calling from a @NonCPS annotated method
          Hide
          jglick Jesse Glick added a comment -

          Stop running build from inside a node block, and drop the @NonCPS annotations.

          Show
          jglick Jesse Glick added a comment - Stop running build from inside a node block, and drop the @NonCPS annotations.

            People

            • Assignee:
              Unassigned
              Reporter:
              lsbwant lsb want
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: