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

Manual Resource reservation is ignored by job waiting for that resource

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins: 2.121.3
      Lockable Resources plugin: 2.3

      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!

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

          Robert Ozdoba added a comment -

          This has the potential to be an issue for my team and I as we transition from Freestyle to Pipeline builds. Are there plans to progress on this?

          Robert Ozdoba added a comment - This has the potential to be an issue for my team and I as we transition from Freestyle to Pipeline builds. Are there plans to progress on this?

          This can not work. Because your jobA is running and jobB is waiting until jobA frees the resource. When you do some reservation action it will be the next one. That means wait for jobB.

          When I remember me correct, it is exact checked, if the reservation-status changes after saving the config page and it is ignored. I think the reason is, that in the save-config action you will change ALL resources, which might a big impact in huge environments. Nobody can grant, that other resources has the same state, as you start with configuring it with the config page.

           

          I think for this reason is implemented 'steal' and 'reassign' action in the main page.

           

          When it helps you, please close this item. Thx

          Martin Pokorny added a comment - This can not work. Because your jobA is running and jobB is waiting until jobA frees the resource. When you do some reservation action it will be the next one. That means wait for jobB. When I remember me correct, it is exact checked, if the reservation-status changes after saving the config page and it is ignored. I think the reason is, that in the save-config action you will change ALL resources, which might a big impact in huge environments. Nobody can grant, that other resources has the same state, as you start with configuring it with the config page.   I think for this reason is implemented 'steal' and 'reassign' action in the main page.   When it helps you, please close this item. Thx

          Daniel Horak added a comment -

          It is already quite long time, so I didn't remember the original scenario (the scenario in Description was "simplified reproducer", our intention was to manually lock some resource from withing pipeline, not from the web UI and we were facing such weird behavior, where resource reservation was sometime ignored).

          Anyway, we already "solved" this and some other limitations of this plugin by using external resource management system, so if this behavior is by design, we can probably close this issue.

          Daniel Horak added a comment - It is already quite long time, so I didn't remember the original scenario (the scenario in Description was "simplified reproducer", our intention was to manually lock some resource from withing pipeline, not from the web UI and we were facing such weird behavior, where resource reservation was sometime ignored). Anyway, we already "solved" this and some other limitations of this plugin by using external resource management system, so if this behavior is by design, we can probably close this issue.

            Unassigned Unassigned
            dahorak Daniel Horak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: