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

NPE in jenkins.plugins.openstack.compute.JCloudsSlave.getRetentionTime(JCloudsSlave.java:109)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      got this while saving System Configuration in Jenkins.

      I have this plugin installed: "Openstack Cloud Plugin
      Allows Jenkins to build using Cloud Servers via JClouds." - Version 1.7.

      this may be applicable to jclouds-plugin as well (see my fix for both below)

      my "retention time" is set to default: 30 (minutes I assume)
      and on "Cloud Instance Templates" level the value shown for retention-override is shown as "0" in the web UI.

      javax.servlet.ServletException: java.lang.NullPointerException
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:123)
      at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:46)
      at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationDataProvider.provideRequestDuring(ScmSyncConfigurationDataProvider.java:103)
      at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter.doFilter(ScmSyncConfigurationFilter.java:42)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:120)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:114)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
      at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
      at org.eclipse.jetty.server.Server.handle(Server.java:370)
      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
      at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
      at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
      at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
      at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
      at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
      at jenkins.plugins.openstack.compute.JCloudsSlave.getRetentionTime(JCloudsSlave.java:109)
      at jenkins.plugins.openstack.compute.JCloudsComputer.getRetentionTime(JCloudsComputer.java:37)
      at jenkins.plugins.openstack.compute.JCloudsRetentionStrategy.check(JCloudsRetentionStrategy.java:32)
      at jenkins.plugins.openstack.compute.JCloudsRetentionStrategy.check(JCloudsRetentionStrategy.java:16)
      at hudson.slaves.SlaveComputer$4.run(SlaveComputer.java:707)
      at hudson.model.Queue._withLock(Queue.java:1286)
      at hudson.model.Queue.withLock(Queue.java:1169)
      at hudson.slaves.SlaveComputer.setNode(SlaveComputer.java:704)
      at hudson.model.AbstractCIBase.updateComputer(AbstractCIBase.java:118)
      at hudson.model.AbstractCIBase.access$000(AbstractCIBase.java:44)
      at hudson.model.AbstractCIBase$2.run(AbstractCIBase.java:186)
      at hudson.model.Queue._withLock(Queue.java:1286)
      at hudson.model.Queue.withLock(Queue.java:1169)
      at hudson.model.AbstractCIBase.updateComputerList(AbstractCIBase.java:169)
      at jenkins.model.Jenkins.updateComputerList(Jenkins.java:1224)
      at jenkins.model.Jenkins.doConfigSubmit(Jenkins.java:2881)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      ... 63 more

      now I see that Openstack jenkins workers are not being deleted when they should be...
      log is full of these messages:

      Jun 30, 2015 10:35:46 AM hudson.triggers.SafeTimerTask run
      SEVERE: Timer task hudson.slaves.ComputerRetentionWork@181dfa27 failed
      java.lang.NullPointerException
      at jenkins.plugins.openstack.compute.JCloudsSlave.getRetentionTime(JCloudsSlave.java:109)
      at jenkins.plugins.openstack.compute.JCloudsComputer.getRetentionTime(JCloudsComputer.java:37)
      at jenkins.plugins.openstack.compute.JCloudsRetentionStrategy.check(JCloudsRetentionStrategy.java:32)
      at jenkins.plugins.openstack.compute.JCloudsRetentionStrategy.check(JCloudsRetentionStrategy.java:16)
      at hudson.slaves.ComputerRetentionWork$1.run(ComputerRetentionWork.java:70)
      at hudson.model.Queue._withLock(Queue.java:1286)
      at hudson.model.Queue.withLock(Queue.java:1169)
      at hudson.slaves.ComputerRetentionWork.doRun(ComputerRetentionWork.java:61)
      at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)

        Attachments

          Activity

          Hide
          alskor Alex Java added a comment -

          I fixed the bug locally and submitted a pull request for Openstack Cloud plugin: https://github.com/jenkinsci/openstack-cloud-plugin/pull/12

          Show
          alskor Alex Java added a comment - I fixed the bug locally and submitted a pull request for Openstack Cloud plugin: https://github.com/jenkinsci/openstack-cloud-plugin/pull/12
          Hide
          alskor Alex Java added a comment -

          and here is a separate pull request for jclouds-plugin https://github.com/jenkinsci/jclouds-plugin/pull/89
          (pretty much the same fix as for Openstack Cloud plugin)

          Show
          alskor Alex Java added a comment - and here is a separate pull request for jclouds-plugin https://github.com/jenkinsci/jclouds-plugin/pull/89 (pretty much the same fix as for Openstack Cloud plugin)
          Hide
          alskor Alex Java added a comment -

          also, this is a real blocker because the plugin cannot even create new instances properly: it launches a new VM and then fails with NPE and get into cycle when it tries to launch another one, then another one, etc - they all fail. and you end up with many unusable VMs and jenkins came to a halt.

          Show
          alskor Alex Java added a comment - also, this is a real blocker because the plugin cannot even create new instances properly: it launches a new VM and then fails with NPE and get into cycle when it tries to launch another one, then another one, etc - they all fail. and you end up with many unusable VMs and jenkins came to a halt.
          Hide
          alskor Alex Java added a comment -

          this is still not merged to jclouds plugin.

          Show
          alskor Alex Java added a comment - this is still not merged to jclouds plugin.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alexey Skorokhodov
          Path:
          jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/CloudInstanceDefaults.java
          jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/JCloudsCloud.java
          jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/JCloudsSlave.java
          jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudInsideJenkinsLiveTest.java
          jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudLiveTest.java
          jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudTest.java
          jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsSlaveTemplateTest.java
          http://jenkins-ci.org/commit/jclouds-plugin/e4f8cdcc8b54c897e626a5aa3f0b179d42b52d93
          Log:
          JENKINS-29136 fix NPE in getRetentionTime()

          I documented the bug here: https://issues.jenkins-ci.org/browse/JENKINS-29136

          this NPE was preventing jenkins workers from being deleted when they should have been.

          I added a defaults class that will be used when parent cloud cannot be resolved
          due to whatever reason.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alexey Skorokhodov Path: jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/CloudInstanceDefaults.java jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/JCloudsCloud.java jclouds-plugin/src/main/java/jenkins/plugins/jclouds/compute/JCloudsSlave.java jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudInsideJenkinsLiveTest.java jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudLiveTest.java jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsCloudTest.java jclouds-plugin/src/test/java/jenkins/plugins/jclouds/compute/JCloudsSlaveTemplateTest.java http://jenkins-ci.org/commit/jclouds-plugin/e4f8cdcc8b54c897e626a5aa3f0b179d42b52d93 Log: JENKINS-29136 fix NPE in getRetentionTime() I documented the bug here: https://issues.jenkins-ci.org/browse/JENKINS-29136 this NPE was preventing jenkins workers from being deleted when they should have been. I added a defaults class that will be used when parent cloud cannot be resolved due to whatever reason.
          Hide
          felfert Fritz Elfert added a comment -

          I manually tweaked. your PR.
          Somehow, tests failed on jenkins.ci.cloudbees.com.
          After removing the static imports of CloudInstantceDefaults test worked again.

          Show
          felfert Fritz Elfert added a comment - I manually tweaked. your PR. Somehow, tests failed on jenkins.ci.cloudbees.com. After removing the static imports of CloudInstantceDefaults test worked again.
          Hide
          felfert Fritz Elfert added a comment -

          Fixed in v2.9

          Show
          felfert Fritz Elfert added a comment - Fixed in v2.9

            People

            • Assignee:
              felfert Fritz Elfert
              Reporter:
              alskor Alex Java
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: