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 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.

          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.

          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.

          Andrew Bayer added a comment -

          Merged, releasing as 2.4.

          Andrew Bayer added a comment - Merged, releasing as 2.4.

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

              Created:
              Updated:
              Resolved: