• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical

      Locking freestyle jobs based on resources, does not work. A job that should be blocked, will be blocked for around one minute, after which it will start executing regardless if the lock holder job is still executing or not.

      The behaviour started in lockable resources plugin version 2.0.

      Steps to reproduce:

      • Install lockable-resources plugin 2.0
      • Add a lockable resource called "abcd" in Global Configuration
      • Create two freestyle jobs, A and B
        • Both should use the lockable resource "abcd"
        • A should block for 2 minutes. Use e.g. shell step "sleep 120"
        • B should block for 20 seconds. This is only so that you will have time to see, when it's executing.
      • Run job A
      • After A has started running (and blocking), run job B
      • Observe Jenkins job queue
        • First B should be blocked by A, hover on it's name and it'll tell you it's blocked by [abcd] and how much time it has waited.
        • After time the wait time has risen over 60 seconds, B should now start running, even though A is still running.
      • Extra: if you look at A:s and B:s console log, they'll have a line:
        [lockable-resources] acquired lock on []

          [JENKINS-47754] lockable-resources broken for freestyle jobs

          Aleksi Aalto added a comment -

          Aleksi Aalto added a comment - Fix PR: https://github.com/jenkinsci/lockable-resources-plugin/pull/80

          Code changed in jenkins
          User: Aleksi Aalto
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
          src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/c20d996d8534470070fb9189646ff55b903ec6f6
          Log:
          Fix locking for freestyle jobs

          Freestyle jobs did not hold the resource locks properly,
          as they did not record the queueProjectName to the queue.
          Any blocked jobs would give up waiting after QUEUE_TIMEOUT
          seconds in the queue, even if there was a job blocking.

          Fixes: JENKINS-47754

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Aleksi Aalto Path: src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java http://jenkins-ci.org/commit/lockable-resources-plugin/c20d996d8534470070fb9189646ff55b903ec6f6 Log: Fix locking for freestyle jobs Freestyle jobs did not hold the resource locks properly, as they did not record the queueProjectName to the queue. Any blocked jobs would give up waiting after QUEUE_TIMEOUT seconds in the queue, even if there was a job blocking. Fixes: JENKINS-47754

          Andrew Bayer added a comment - - edited

          Merged, releasing now as 2.1

          Andrew Bayer added a comment - - edited Merged, releasing now as 2.1

            Unassigned Unassigned
            aga Aleksi Aalto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: