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

lockable-resources broken for freestyle jobs

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Environment:
    • Similar Issues:

      Description

      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 []

        Attachments

          Activity

          Show
          aga Aleksi Aalto added a comment - Fix PR: https://github.com/jenkinsci/lockable-resources-plugin/pull/80
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          Hide
          abayer Andrew Bayer added a comment - - edited

          Merged, releasing now as 2.1

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: