• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None
    • jenkins 2.54 lockable resources plugin 2.0

      We are doing automated regression testing with jenkins and using the lockable resources plugin to run one test job at a time. But sometimes it fails to acquire the lock on the testing system and one or more test job starts before the first one finished depending on when the lockable resource plugin starts to work again. Example wrong behavior:
      17:09:23 Started by timer

      17:09:23 [lockable-resources] acquired lock on []

      17:09:23 [EnvInject] - Loading node environment variables.
      Please tell me what kind of logs do you need to debug this issue.

          [JENKINS-43574] Lockable resources plugin does not take effect

          We had the same problem, with one of our 5 lockable resources. We downgraded to 1.11.2 and updated all configuration using the plugin and everything is working like before.

          Patrick Visser added a comment - We had the same problem, with one of our 5 lockable resources. We downgraded to 1.11.2 and updated all configuration using the plugin and everything is working like before.

          Also same problem with 2.0, generated jobs.

          At first, one job holds the resource, the other one waits, resource is showing as queued.

          After a short delay, the second job suddenly starts, the resource itself switches to "unlocked" state, and the second job shows the empty brackets: [].

          Now both jobs are running simulataniously and the resource is incorrectly unlocked.

          Andreas Ringlstetter added a comment - Also same problem with 2.0, generated jobs. At first, one job holds the resource, the other one waits, resource is showing as queued. After a short delay, the second job suddenly starts, the resource itself switches to "unlocked" state, and the second job shows the empty brackets: []. Now both jobs are running simulataniously and the resource is incorrectly unlocked.

          Andreas Ringlstetter added a comment - - edited

          For cross reference: https://github.com/jenkinsci/lockable-resources-plugin/issues/54

          debfx pointed out that version 2.0 creates invalid configurations:

              <org.jenkins.plugins.lockableresources.RequiredResourcesProperty plugin="lockable-resources@1.11.2">
                <resourceNames>ResX ResY</resourceNames>
                <resourceNamesVar></resourceNamesVar>
                <resourceNumber></resourceNumber>
                <labelName></labelName>
              </org.jenkins.plugins.lockableresources.RequiredResourcesProperty

          while the previous version serialized into a configuration like this:

              <org.jenkins.plugins.lockableresources.RequiredResourcesProperty plugin="lockable-resources@1.11.2">
                <resourceNames>ResX ResY</resourceNames>
              </org.jenkins.plugins.lockableresources.RequiredResourcesProperty>

          Note how the missing (nulled) options were replaced by empty options instead?

          Unbreaking the configuration also works again with 2.0. Using the broken 2.0 configuration with 1.11.2 also triggers the bug.

          Andreas Ringlstetter added a comment - - edited For cross reference: https://github.com/jenkinsci/lockable-resources-plugin/issues/54 debfx pointed out that version 2.0 creates invalid configurations: <org.jenkins.plugins.lockableresources.RequiredResourcesProperty plugin= "lockable-resources@1.11.2" > <resourceNames>ResX ResY</resourceNames> <resourceNamesVar></resourceNamesVar> <resourceNumber></resourceNumber> <labelName></labelName> </org.jenkins.plugins.lockableresources.RequiredResourcesProperty while the previous version serialized into a configuration like this: <org.jenkins.plugins.lockableresources.RequiredResourcesProperty plugin= "lockable-resources@1.11.2" > <resourceNames>ResX ResY</resourceNames> </org.jenkins.plugins.lockableresources.RequiredResourcesProperty> Note how the missing (nulled) options were replaced by empty options instead? Unbreaking the configuration also works again with 2.0. Using the broken 2.0 configuration with 1.11.2 also triggers the bug.

          Alec Ishak added a comment - - edited

          I believe I found a solution for this in the plugin code. In RequiredResourcesProperty.java there is this snippet in the RequiredResourcesProperty constructor. 

          this.resourceNames = resourceNames;
          this.resourceNamesVar = resourceNamesVar;
          this.resourceNumber = resourceNumber;

          The label name is set a little further down in the same way. It looks like these are getting set to an empty string when they should be getting set to null. I just added a little type checking and it works for me. 

          this.resourceNames = resourceNames;
          if (resourceNamesVar.equals("")) {
          this.resourceNamesVar = null
          } else {
          this.resourceNamesVar = resourceNamesVar;
          }
          if (resourceNumber.equals("")) {
          this.resourceNumber = null
          } else {
          this.resourceNumber = resourceNumber;
          }

          This fixes the job config issue pointed out by Andreas. 

          Alec Ishak added a comment - - edited I believe I found a solution for this in the plugin code. In RequiredResourcesProperty.java there is this snippet in the RequiredResourcesProperty constructor.  this.resourceNames = resourceNames; this.resourceNamesVar = resourceNamesVar; this.resourceNumber = resourceNumber; The label name is set a little further down in the same way. It looks like these are getting set to an empty string when they should be getting set to null. I just added a little type checking and it works for me.  this.resourceNames = resourceNames; if (resourceNamesVar.equals("")) { this.resourceNamesVar = null } else { this.resourceNamesVar = resourceNamesVar; } if (resourceNumber.equals("")) { this.resourceNumber = null } else { this.resourceNumber = resourceNumber; } This fixes the job config issue pointed out by Andreas. 

          Stephan Krull added a comment -

          @abayer: Are you aware of this? We still have this issue in version 2.1

          Stephan Krull added a comment - @ abayer : Are you aware of this? We still have this issue in version 2.1

          Stephan Krull added a comment -

          Set up a PR to get that one done.

          Stephan Krull added a comment - Set up a PR to get that one done.

          Code changed in jenkins
          User: krull
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          src/test/java/org/jenkins/plugins/lockableresources/BasicIntegrationTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/1e440bfbbd803400065c062ae6bba9b86a7e45ac
          Log:
          JENKINS-43574: fix construction of RequiredResourcesProperty

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: krull Path: src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java src/test/java/org/jenkins/plugins/lockableresources/BasicIntegrationTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/1e440bfbbd803400065c062ae6bba9b86a7e45ac Log: JENKINS-43574 : fix construction of RequiredResourcesProperty

          Code changed in jenkins
          User: krull
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/90bee03e8972183210ca5510f4e276bc8097cdb7
          Log:
          JENKINS-43574: replace whitespaces with tabs

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: krull Path: src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java http://jenkins-ci.org/commit/lockable-resources-plugin/90bee03e8972183210ca5510f4e276bc8097cdb7 Log: JENKINS-43574 : replace whitespaces with tabs

          Code changed in jenkins
          User: Antonio Muniz
          Path:
          src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java
          src/test/java/org/jenkins/plugins/lockableresources/BasicIntegrationTest.java
          http://jenkins-ci.org/commit/lockable-resources-plugin/67a01b44f4a995955e0888db62f927fcc740697a
          Log:
          Merge pull request #89 from krulls/master

          JENKINS-43574: fix construction of RequiredResourcesProperty

          Compare: https://github.com/jenkinsci/lockable-resources-plugin/compare/3b9717e389f7...67a01b44f4a9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Muniz Path: src/main/java/org/jenkins/plugins/lockableresources/RequiredResourcesProperty.java src/test/java/org/jenkins/plugins/lockableresources/BasicIntegrationTest.java http://jenkins-ci.org/commit/lockable-resources-plugin/67a01b44f4a995955e0888db62f927fcc740697a Log: Merge pull request #89 from krulls/master JENKINS-43574 : fix construction of RequiredResourcesProperty Compare: https://github.com/jenkinsci/lockable-resources-plugin/compare/3b9717e389f7...67a01b44f4a9

          Released as 2.2

          Antonio Muñiz added a comment - Released as 2.2

            Unassigned Unassigned
            szanics Bela Szanics
            Votes:
            11 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: