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

Lockable Resource Plugin throws null pointer exception

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • Jenkins LTS 2.60.1
      Lockable Resources Plugin v2.0

      The Lockable Resources Plugin throws a null pointer exception if the org.jenkins.plugins.lockableresources.LockableResourcesManager.xml file contains an entry that does not have a name field.

       

      For example,

      <org.jenkins.plugins.lockableresources.LockableResource>
      <description></description>
      <labels></labels>
      <queueItemId>0</queueItemId>
      <queuingStarted>0</queuingStarted>
      <queuedContexts/>
      </org.jenkins.plugins.lockableresources.LockableResource>
      

      The following stacktrace could be seen on the build console output - for version 1.11.2

      ava.lang.NullPointerException
      	at org.jenkins.plugins.lockableresources.LockableResourcesManager.freeResources(LockableResourcesManager.java:261)
      	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:300)
      	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:285)
      	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:273)
      	at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnlock(LockableResourcesRootAction.java:103)
      	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
      	at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      Caused: javax.servlet.ServletException
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765)
      

          [JENKINS-46555] Lockable Resource Plugin throws null pointer exception

          James Sweet created issue -
          James Sweet made changes -
          Description Original: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,

          {{ <org.jenkins.plugins.lockableresources.LockableResource>}}
          {{ <description></description>}}
          {{ <labels></labels>}}
          {{ <queueItemId>0</queueItemId>}}
          {{ <queuingStarted>0</queuingStarted>}}
          {{ <queuedContexts/>}}
          {{ </org.jenkins.plugins.lockableresources.LockableResource>}}
          New: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,

          <org.jenkins.plugins.lockableresources.LockableResource>
          <description></description>
          <labels></labels>
          <queueItemId>0</queueItemId>
          <queuingStarted>0</queuingStarted>
          <queuedContexts/>
          </org.jenkins.plugins.lockableresources.LockableResource>

          James Sweet added a comment - - edited

          There are currently no known steps to recreate the issue.

          The workaround to resolve the issue is to manually view the org.jenkins.plugins.lockableresources.LockableResourcesManager.xml file and remove the entries that have no <name> field.  Restart Jenkins and try again with regards to the lockable resource.

          James Sweet added a comment - - edited There are currently no known steps to recreate the issue. The workaround to resolve the issue is to manually view the org.jenkins.plugins.lockableresources.LockableResourcesManager.xml file and remove the entries that have no <name> field.  Restart Jenkins and try again with regards to the lockable resource.
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal CD-311 (Web Link)" [ 19042 ]

          Lionel Orellana added a comment - - edited

          I didn't have any entries with no <name>. Had to manually delete the offending lock from the xml and restart.

          Lionel Orellana added a comment - - edited I didn't have any entries with no <name>. Had to manually delete the offending lock from the xml and restart.
          Félix Belzunce Arcos made changes -
          Description Original: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,

          <org.jenkins.plugins.lockableresources.LockableResource>
          <description></description>
          <labels></labels>
          <queueItemId>0</queueItemId>
          <queuingStarted>0</queuingStarted>
          <queuedContexts/>
          </org.jenkins.plugins.lockableresources.LockableResource>
          New: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,


          {code:java}
          <org.jenkins.plugins.lockableresources.LockableResource>
          <description></description>
          <labels></labels>
          <queueItemId>0</queueItemId>
          <queuingStarted>0</queuingStarted>
          <queuedContexts/>
          </org.jenkins.plugins.lockableresources.LockableResource>
          {code}
          Félix Belzunce Arcos made changes -
          Assignee New: Félix Belzunce Arcos [ fbelzunc ]
          Félix Belzunce Arcos made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          I think the problem here is that somewhere you are trying to create locks programmatically with createResource or createResourceWithLabel and it produces that sometimes null locks are created.

          The plugin should protect against this.

          Félix Belzunce Arcos added a comment - I think the problem here is that somewhere you are trying to create locks programmatically with createResource or createResourceWithLabel and it produces that sometimes null locks are created. The plugin should protect against this.
          Félix Belzunce Arcos made changes -
          Description Original: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,


          {code:java}
          <org.jenkins.plugins.lockableresources.LockableResource>
          <description></description>
          <labels></labels>
          <queueItemId>0</queueItemId>
          <queuingStarted>0</queuingStarted>
          <queuedContexts/>
          </org.jenkins.plugins.lockableresources.LockableResource>
          {code}
          New: The Lockable Resources Plugin throws a null pointer exception if the {{org.jenkins.plugins.lockableresources.LockableResourcesManager.xml}} file contains an entry that does not have a name field.

           

          For example,


          {code:java}
          <org.jenkins.plugins.lockableresources.LockableResource>
          <description></description>
          <labels></labels>
          <queueItemId>0</queueItemId>
          <queuingStarted>0</queuingStarted>
          <queuedContexts/>
          </org.jenkins.plugins.lockableresources.LockableResource>
          {code}

          The following stacktrace could be seen on the build console output - for version 1.11.2


          {code:java}
          ava.lang.NullPointerException
          at org.jenkins.plugins.lockableresources.LockableResourcesManager.freeResources(LockableResourcesManager.java:261)
          at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:300)
          at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:285)
          at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:273)
          at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnlock(LockableResourcesRootAction.java:103)
          at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
          at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
          at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
          at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
          at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
          at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
          Caused: javax.servlet.ServletException
          at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765)
          {code}

            fbelzunc Félix Belzunce Arcos
            jtsweet James Sweet
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: