jenkinsci / jenkinsci/lockable-resources-plugin

[JENKINS-59803] Manual Resource reservation is ignored by job waiting for that resource

Open
#923 3 comments 0 reactions 0 assignees View on GitHub
component:lockable-resources-plugin imported-jira-issue priority:major resolution:unresolved Triage
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

If Resource is reserved from Jenkins configuration page, already running job waiting for that resource ignores the new reservation.

Create resource foo and prepare pipeline job with piece of code like this:

lock(resource: "foo", quantity: 1) {

   sleep 120

}

Then perform following steps:



  1. Start this job twice in a row.

    {{ The first build should lock the resource and start the }}sleep step{{, the second will be waiting for the resource.}}

  2. Go to Manage Jenkins -> Configure System -> Lockable Resources Manager section and fill Reserved by field for the foo resource }}{{by some text{{ and apply the changes (you should do this within the configured sleep time in the job - 2 minutes in the example above).}}{{}}

  3. Wait till the first job finishes and check the second job.{{}}

Actual results:

The second job acquires the lock and continue to the sleep step.

Expected results:

The second job should stay waiting for the resource, because the resource was manually reserved!

---
Originally reported by dahorak, imported from: Manual Resource reservation is ignored by job waiting for that resource


  • status: Open
  • priority: Major
  • component(s): lockable-resources-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 20251217-081411

Raw content of original issue

If Resource is reserved from Jenkins configuration page, already running job waiting for that resource ignores the new reservation.

Create resource foo and prepare pipeline job with piece of code like this:

lock(resource: "foo", quantity: 1) {
   sleep 120
}

Then perform following steps:



  1. Start this job twice in a row.
    {{ The first build should lock the resource and start the }}sleep step{{, the second will be waiting for the resource.}}

  2. Go to Manage Jenkins -> Configure System -> Lockable Resources Manager section and fill Reserved by field for the foo resource }}{{by some text{{ and apply the changes (you should do this within the configured sleep time in the job - 2 minutes in the example above).}}{{}}

  3. Wait till the first job finishes and check the second job.{{}}

Actual results:
The second job acquires the lock and continue to the sleep step.

Expected results:
The second job should stay waiting for the resource, because the resource was manually reserved!

environment

```
Jenkins: 2.121.3

Lockable Resources plugin: 2.3
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the lockable-resources-plugin with a Jenkins pipeline using lock(resource: "foo", quantity: 1) and two builds. Then trace how the Lockable Resources Manager reservation is checked while a queued build waits. Done means a manually reserved resource keeps the waiting build blocked after the current holder finishes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ci-cd, 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.