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

Certain conditions might lock more resources than required quantity

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • CloudBees Jenkins Enterprise 2.32.2.1-rolling
      lockable resources plugin version 1.x & 2.x

      In strained situations, more resources than you asked for might get locked. This creates a bottleneck problem related to resources but it cannot be solved by adding more resources.

      In worst cases will always lock all resources with a certain label instead of the required amount.

      You can recreate the issue by configuring a couple (say 4) of lockable resources with a tag. Trigger a bunch of these jobs with NUM_RESOURCES between 1 - 4 to build up a queue of jobs waiting for their resources to become available. Eventually the error will start appearing.

      properties([
          parameters ([
              string(name: 'NUM_RESOURCES')
          ])
      ]);
      
      node {
          def askFor = params.NUM_RESOURCES as Integer
          lock(label: "FOO", quantity: askFor) {
              def clients = org.jenkins.plugins.lockableresources.LockableResourcesManager.class.get().getResourcesFromBuild(currentBuild.getRawBuild())
              echo("Asked for ${askFor} resources, got ${clients.size()}: ${clients.toString()}")
              sleep (60 * 10)
              if (askFor != clients.size()) {
                  error ("Wrong amount of resources acquired")
              }
          }
      }
      

            Unassigned Unassigned
            mantonsson Marcus Antonsson
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: