Hi,

      We found a potential bug that can only be replicated in pipeline jobs. Essentially when a job a running and a Jenkins restart occurs, the job is left hanging infinitely:

      Resuming build at Tue Jan 03 10:37:18 UTC 2017 after Jenkins restart
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      Waiting to resume part of TestRun2 #2: Waiting for next available executor
      ...
      

      I noticed that this behaviour does not exhibit on any other job types. i.e. freestyle.

      Here is a simple test pipeline script:

      node('XXXXX') {
      
        stage 'Stage 1'
          println 'Deploying to Stage 1...'
      
        stage 'Stage 2'
          println 'Running Tests in Stage 2'
          sleep 120
          println 'Tests passed!'
      
        stage 'Stage 3'
          println 'Deploying to Stage 3...'
      
      }
      

      ...Restart Jenkins as soon as it enters Stage 2, to replicate such behaviour.

      Currently I am using version 2.3, but I believe this issue was replicated in previous versions.

      Please can you help me explain why this behaviour only exists in pipeline jobs?

      Kind Regards,
      Tuan

          [JENKINS-40771] Race condition in FlowExecutionList

          Tuan Nguyen created issue -
          Tuan Nguyen made changes -
          Summary Original: Pipeline causes job to hang infinitely on restart New: Pipeline causes job to hang infinitely on Jenkins restart
          Tuan Nguyen made changes -
          Description Original: Hi,

          We found a potential bug that can only be replicated in pipeline jobs. Essentially when a job a running and a Jenkins restart occurs, the job is left hanging infinitely:
          {noformat}
          Resuming build at Tue Jan 03 10:37:18 UTC 2017 after Jenkins restart
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          ...
          {noformat}

          I noticed that this does not occur on any other job types. i.e. freestyle.


          Here is a simple test pipeline script:
          {noformat}
          node('XXXXX') {

            stage 'Stage 1'
              println 'Deploying to Stage 1...'

            stage 'Stage 2'
              println 'Running Tests in Stage 2'
              sleep 120
              println 'Tests passed!'

            stage 'Stage 3'
              println 'Deploying to Stage 3...'

          }
          {noformat}
          ...Restart Jenkins as soon as it enters Stage 2, to replicate such behaviour.

          Currently I am using version 2.3, but I believe this issue was replicated in previous versions.

          Please can you help me explain why this behaviour only exists in pipeline jobs?

          Kind Regards,
          Tuan
          New: Hi,

          We found a potential bug that can only be replicated in pipeline jobs. Essentially when a job a running and a Jenkins restart occurs, the job is left hanging infinitely:
          {noformat}
          Resuming build at Tue Jan 03 10:37:18 UTC 2017 after Jenkins restart
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          Waiting to resume part of TestRun2 #2: Waiting for next available executor
          ...
          {noformat}

          I noticed that this behaviour does not exhibit on any other job types. i.e. freestyle.


          Here is a simple test pipeline script:
          {noformat}
          node('XXXXX') {

            stage 'Stage 1'
              println 'Deploying to Stage 1...'

            stage 'Stage 2'
              println 'Running Tests in Stage 2'
              sleep 120
              println 'Tests passed!'

            stage 'Stage 3'
              println 'Deploying to Stage 3...'

          }
          {noformat}
          ...Restart Jenkins as soon as it enters Stage 2, to replicate such behaviour.

          Currently I am using version 2.3, but I believe this issue was replicated in previous versions.

          Please can you help me explain why this behaviour only exists in pipeline jobs?

          Kind Regards,
          Tuan
          Jesse Glick made changes -
          Component/s New: workflow-basic-steps-plugin [ 21712 ]
          Component/s Original: workflow-aggregator-plugin [ 21710 ]
          Jesse Glick made changes -
          Resolution New: Incomplete [ 4 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Tuan Nguyen made changes -
          Resolution Original: Incomplete [ 4 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Component/s New: workflow-api-plugin [ 21711 ]
          Component/s Original: workflow-basic-steps-plugin [ 21712 ]
          Labels New: threads
          Summary Original: Pipeline causes job to hang infinitely on Jenkins restart New: Race condition in FlowExecutionList
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Reopened [ 4 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 31 (Web Link)" [ 15446 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

            jglick Jesse Glick
            derng Tuan Nguyen
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: