jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-42616] Restarted Jobs consume Nodes when not necessary

Open
#1,289 1 comment 0 reactions 0 assignees View on GitHub
component:workflow-cps-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
186
Forks
213
Avg merge
12h 12m
Merged PRs (30d)
8

Description

May be related to 



  1. JENKINS-40771

 

In the following situation, we have a single job that runs a function which requires a node.

Upon restart the job consumes 1 more mode than expected.

I expect only a single node to be used at any time.  Before restart this is the case, after restart this is not.

The additional node is consumed until the parallel call is finished.

If this additional node happens to be the only available node then the pending jobs will be stuck waiting for executor.

Pictures attached.

To reproduce:



  1. Run the following pipeline script

  2. Once its running restart server

  3. Observe the build queue

This has been tested using the windows service and running from the cmdline using: "java -jar jenkins.war --httpPort=8082"

```
def run_function (String words){
return {
node (){
sleep(300)
println words
}
}
}
Map parllel_map
node () {
println "Using my frist node"
parllel_map = [
'A': run_function("A")
]
}
parallel parllel_map

```

---
Originally reported by matthall, imported from: Restarted Jobs consume Nodes when not necessary


  • status: Open
  • priority: Major
  • component(s): workflow-cps-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-07

Raw content of original issue

May be related to 



  1. JENKINS-40771

 

In the following situation, we have a single job that runs a function which requires a node.

Upon restart the job consumes 1 more mode than expected.

I expect only a single node to be used at any time.  Before restart this is the case, after restart this is not.

The additional node is consumed until the parallel call is finished.

If this additional node happens to be the only available node then the pending jobs will be stuck waiting for executor.

Pictures attached.

To reproduce:



  1. Run the following pipeline script

  2. Once its running restart server

  3. Observe the build queue

This has been tested using the windows service and running from the cmdline using: "java -jar jenkins.war --httpPort=8082"



def run_function (String words){

return {
node (){
sleep(300)
println words
}
}
}
Map parllel_map
node () {
println "Using my frist node"
parllel_map = [
'A': run_function("A")
]
}
parallel parllel_map

environment

```
Chrome

Jenkins ver. 2.19.4

Pipeline 2.5
```

3 attachments

- [42616.PNG](https://issues.jenkins.io/secure/attachment/36353/42616.PNG)
> ![42616.PNG](https://issues.jenkins.io/secure/attachment/36353/42616.PNG)
- [after restart.png](https://issues.jenkins.io/secure/attachment/36352/after%20restart.png)
> ![after restart.png](https://issues.jenkins.io/secure/attachment/36352/after%20restart.png)
- [before restart.png](https://issues.jenkins.io/secure/attachment/36351/before%20restart.png)
> ![before restart.png](https://issues.jenkins.io/secure/attachment/36351/before%20restart.png)

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by running the provided Pipeline script on Jenkins 2.19.4, restarting the server while it runs, and observing the build queue; then trace the workflow-cps-plugin restart behavior. Done means the restarted job uses only the expected node and pending jobs are not blocked by an unnecessary executor.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.