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

Lockable Resources does not unlock after manual unlock via GUI

      When I manually lock some resource via GUI than some pipeline job stop at the point when it is waiting for that resource. So far so good. But when I unlock the resource, pipeline job remain freezed  in the state waiting for this resource and it never continues even if the resource is free to use.

          [JENKINS-49503] Lockable Resources does not unlock after manual unlock via GUI

          Gerard Ryan added a comment -

          I also have this issue. I unlock the resource manually (after manually taking the lock), and the pipeline job is left waiting. Even if I restart Jenkins, the pipeline gets resumed properly, but it still doesn't get the updated lock status. Is there any way to update the status of it that the pipeline sees, or is there a better way of doing this that I'm not familiar with (this is my first time using this plugin)?

          Here's my test pipeline:

          lock('my-lock') {
              echo "I got the lock!"
          }
          

          Here's what I see in the console output (resource 'my-lock' was manually reserved before triggering, but released a long time ago):

          Started by user developer
          [Pipeline] lock
          Trying to acquire lock on [my-lock]
          Found 0 available resource(s). Waiting for correct amount: 1.
          [my-lock] is locked, waiting...
          Resuming build at Wed Jun 27 11:20:35 UTC 2018 after Jenkins restart
          <spinning wheel>
          

          Is there something else I should be doing?

          I've figured out one workaround: if I trigger another run of the job, then that will be able to take the lock successfully, then the stuck run will be able to take it after. Also, it doesn't appear to need to be a run of the same pipeline – a run of any job that requests the resource will allow the stuck pipeline to become unstuck. Maybe this is useful for you david_pamanek?

          Until this works reliably, I'll likely either just create a pipeline for manually acquiring the lock, with just an input step to free it; or else have a dummy 'flush' job that takes and releases the resource, to allow any queued jobs to continue.

          Gerard Ryan added a comment - I also have this issue. I unlock the resource manually (after manually taking the lock), and the pipeline job is left waiting. Even if I restart Jenkins, the pipeline gets resumed properly, but it still doesn't get the updated lock status. Is there any way to update the status of it that the pipeline sees, or is there a better way of doing this that I'm not familiar with (this is my first time using this plugin)? Here's my test pipeline: lock( 'my-lock' ) { echo "I got the lock!" } Here's what I see in the console output (resource 'my-lock' was manually reserved before triggering, but released a long time ago): Started by user developer [Pipeline] lock Trying to acquire lock on [my-lock] Found 0 available resource(s). Waiting for correct amount: 1. [my-lock] is locked, waiting... Resuming build at Wed Jun 27 11:20:35 UTC 2018 after Jenkins restart <spinning wheel> Is there something else I should be doing? I've figured out one workaround: if I trigger another run of the job, then that will be able to take the lock successfully, then the stuck run will be able to take it after. Also, it doesn't appear to need to be a run of the same pipeline – a run of any job that requests the resource will allow the stuck pipeline to become unstuck. Maybe this is useful for you david_pamanek ? Until this works reliably, I'll likely either just create a pipeline for manually acquiring the lock, with just an input step to free it; or else have a dummy 'flush' job that takes and releases the resource, to allow any queued jobs to continue.

            Unassigned Unassigned
            david_pamanek David Pamanek
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: