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

Using libvirt slave 'Before Job Snapshot' causes NPE

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • libvirt-slave-plugin
    • None
    • Jenkins ver. 1.565.2
      libvirt-slave 1.8.4

      I tried configuring a node to reset to a snapshot before any job starts, but it seems the job does not wait for this to finish.

      You can see from the build log that it triggers a snapshot revert, and then immediately proceeds to the scm checkout step of the job:

      Started by user Mikal H Henriksen
      Got snapshot phoenix from slave/node configuration
      Preparing to revert phoenix to snapshot phoenix.
      Building remotely on node-host (amd64) in workspace /var/jenkins/workspace/one-phoenix-3.1
      java.io.IOException: remote file operation failed: /var/jenkins/workspace/one-phoenix-3.1 at hudson.remoting.Channel@56eac72e:bgo-vmeo-smokeandmirrors-libvirt
      	at hudson.FilePath.act(FilePath.java:916)
      	at hudson.FilePath.act(FilePath.java:893)
      	at hudson.FilePath.mkdirs(FilePath.java:1063)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1245)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      	at hudson.model.Run.execute(Run.java:1706)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:232)
      Caused by: hudson.remoting.ChannelClosedException: channel is already closed
      	at hudson.remoting.Channel.send(Channel.java:541)
      	at hudson.remoting.Request.call(Request.java:129)
      	at hudson.remoting.Channel.call(Channel.java:739)
      	at hudson.FilePath.act(FilePath.java:909)
      	... 10 more
      Caused by: java.io.IOException
      	at hudson.remoting.Channel.close(Channel.java:1027)
      	at hudson.remoting.Channel.close(Channel.java:1009)
      	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84)
      	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58)
      	at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
      	at hudson.model.Run.execute(Run.java:1702)
      	... 3 more
      

      After that follows more steps like archiving failing in the same way.

          [JENKINS-24654] Using libvirt slave 'Before Job Snapshot' causes NPE

          I'll provide more details tomorrow, I left the job running now after a manual snapshot revert

          Mikal Henriksen added a comment - I'll provide more details tomorrow, I left the job running now after a manual snapshot revert

          Checked the Jenkins main log, seems there's a pretty obvious cause:

          Sep 11, 2014 10:24:19 AM WARNING hudson.model.listeners.RunListener report
          RunListener failed
          java.lang.NullPointerException
          	at hudson.plugins.libvirt.VirtualMachineSlaveComputer.disconnect(VirtualMachineSlaveComputer.java:59)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:85)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58)
          	at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
          	at hudson.model.Run.execute(Run.java:1702)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:232)
          
          Sep 11, 2014 10:24:19 AM WARNING hudson.model.AbstractBuild$AbstractBuildExecution reportError
          Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
          hudson.remoting.ChannelClosedException: channel is already closed
          	at hudson.remoting.Channel.send(Channel.java:541)
          	at hudson.remoting.Request.call(Request.java:129)
          	at hudson.remoting.Channel.call(Channel.java:739)
          	at hudson.EnvVars.getRemote(EnvVars.java:404)
          	at hudson.model.Computer.getEnvironment(Computer.java:912)
          	at jenkins.model.CoreEnvironmentContributor.buildEnvironmentFor(CoreEnvironmentContributor.java:29)
          	at hudson.model.Run.getEnvironment(Run.java:2221)
          	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:885)
          	at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:126)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
          	at hudson.model.Build$BuildExecution.post2(Build.java:182)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:669)
          	at hudson.model.Run.execute(Run.java:1731)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:232)
          Caused by: java.io.IOException
          	at hudson.remoting.Channel.close(Channel.java:1027)
          	at hudson.remoting.Channel.close(Channel.java:1009)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58)
          	at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
          	at hudson.model.Run.execute(Run.java:1702)
          	... 3 more
          
          Sep 11, 2014 10:24:19 AM WARNING hudson.model.AbstractBuild$AbstractBuildExecution reportError
          Publisher hudson.tasks.Mailer aborted due to exception
          hudson.remoting.ChannelClosedException: channel is already closed
          	at hudson.remoting.Channel.send(Channel.java:541)
          	at hudson.remoting.Request.call(Request.java:129)
          	at hudson.remoting.Channel.call(Channel.java:739)
          	at hudson.EnvVars.getRemote(EnvVars.java:404)
          	at hudson.model.Computer.getEnvironment(Computer.java:912)
          	at jenkins.model.CoreEnvironmentContributor.buildEnvironmentFor(CoreEnvironmentContributor.java:29)
          	at hudson.model.Run.getEnvironment(Run.java:2221)
          	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:885)
          	at hudson.tasks.Mailer.perform(Mailer.java:134)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
          	at hudson.model.Build$BuildExecution.post2(Build.java:182)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:669)
          	at hudson.model.Run.execute(Run.java:1731)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:232)
          Caused by: java.io.IOException
          	at hudson.remoting.Channel.close(Channel.java:1027)
          	at hudson.remoting.Channel.close(Channel.java:1009)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84)
          	at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58)
          	at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
          	at hudson.model.Run.execute(Run.java:1702)
          	... 3 more
          

          The last two log entries aren't useful but included for completeness.

          The npe is obvious when you look at the lines LibvirtSnapshotRevertRunListener:59 and LibvirtSnapshotRevertRunListener:85 since cause is always null.

          Mikal Henriksen added a comment - Checked the Jenkins main log, seems there's a pretty obvious cause: Sep 11, 2014 10:24:19 AM WARNING hudson.model.listeners.RunListener report RunListener failed java.lang.NullPointerException at hudson.plugins.libvirt.VirtualMachineSlaveComputer.disconnect(VirtualMachineSlaveComputer.java:59) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:85) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58) at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213) at hudson.model.Run.execute(Run.java:1702) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) Sep 11, 2014 10:24:19 AM WARNING hudson.model.AbstractBuild$AbstractBuildExecution reportError Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception hudson.remoting.ChannelClosedException: channel is already closed at hudson.remoting.Channel.send(Channel.java:541) at hudson.remoting.Request.call(Request.java:129) at hudson.remoting.Channel.call(Channel.java:739) at hudson.EnvVars.getRemote(EnvVars.java:404) at hudson.model.Computer.getEnvironment(Computer.java:912) at jenkins.model.CoreEnvironmentContributor.buildEnvironmentFor(CoreEnvironmentContributor.java:29) at hudson.model.Run.getEnvironment(Run.java:2221) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:885) at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:126) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.post2(Build.java:182) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:669) at hudson.model.Run.execute(Run.java:1731) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) Caused by: java.io.IOException at hudson.remoting.Channel.close(Channel.java:1027) at hudson.remoting.Channel.close(Channel.java:1009) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58) at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213) at hudson.model.Run.execute(Run.java:1702) ... 3 more Sep 11, 2014 10:24:19 AM WARNING hudson.model.AbstractBuild$AbstractBuildExecution reportError Publisher hudson.tasks.Mailer aborted due to exception hudson.remoting.ChannelClosedException: channel is already closed at hudson.remoting.Channel.send(Channel.java:541) at hudson.remoting.Request.call(Request.java:129) at hudson.remoting.Channel.call(Channel.java:739) at hudson.EnvVars.getRemote(EnvVars.java:404) at hudson.model.Computer.getEnvironment(Computer.java:912) at jenkins.model.CoreEnvironmentContributor.buildEnvironmentFor(CoreEnvironmentContributor.java:29) at hudson.model.Run.getEnvironment(Run.java:2221) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:885) at hudson.tasks.Mailer.perform(Mailer.java:134) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.post2(Build.java:182) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:669) at hudson.model.Run.execute(Run.java:1731) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) Caused by: java.io.IOException at hudson.remoting.Channel.close(Channel.java:1027) at hudson.remoting.Channel.close(Channel.java:1009) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84) at hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58) at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213) at hudson.model.Run.execute(Run.java:1702) ... 3 more The last two log entries aren't useful but included for completeness. The npe is obvious when you look at the lines LibvirtSnapshotRevertRunListener:59 and LibvirtSnapshotRevertRunListener:85 since cause is always null.

            bgermann Bastian Germann
            stylpe Mikal Henriksen
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: