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

Unexpected end of ZLIB input stream on permission errors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None

      When trying to archive an artifact which is not readable by the user running Jenkins from a slave started via SSH I get the stack trace:

      [test] $ /bin/sh -xe /tmp/jenkins663015508021388474.sh
       + echo foo
       + sudo chown root bar.txt
       + sudo chmod 600 bar.txt
       Archiving artifacts
       ERROR: Failed to archive artifacts: bar.txt
       java.io.EOFException: Unexpected end of ZLIB input stream
       at com.jcraft.jzlib.InflaterInputStream.fill(InflaterInputStream.java:186)
       at com.jcraft.jzlib.InflaterInputStream.read(InflaterInputStream.java:106)
       at org.apache.commons.compress.utils.IOUtils.readFully(IOUtils.java:160)
       at org.apache.commons.compress.utils.IOUtils.readFully(IOUtils.java:134)
       at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.readRecord(TarArchiveInputStream.java:419)
       at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getRecord(TarArchiveInputStream.java:388)
       at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:269)
       at hudson.FilePath.readFromTar(FilePath.java:2295)
       Also: Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to test
       at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1655)
       at hudson.remoting.UserResponse.retrieve(UserRequest.java:308)
       at hudson.remoting.Channel$2.adapt(Channel.java:940)
       at hudson.remoting.Channel$2.adapt(Channel.java:937)
       at hudson.remoting.FutureAdapter.get(FutureAdapter.java:59)
       at hudson.FilePath.copyRecursiveTo(FilePath.java:2224)
       at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61)
       at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:245)
       at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
       at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:736)
       at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:682)
       at hudson.model.Build$BuildExecution.post2(Build.java:186)
       at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:627)
       at hudson.model.Run.execute(Run.java:1749)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:421)
       java.io.IOException: This archives contains unclosed entries.
       at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:225)
       at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:241)
       at hudson.util.io.TarArchiver.close(TarArchiver.java:127)
       at hudson.FilePath.writeToTar(FilePath.java:2281)
       at hudson.FilePath.access$2100(FilePath.java:196)
       at hudson.FilePath$45.invoke(FilePath.java:2216)
       at hudson.FilePath$45.invoke(FilePath.java:2212)
       at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2760)
       at hudson.remoting.UserRequest.perform(UserRequest.java:205)
       at hudson.remoting.UserRequest.perform(UserRequest.java:52)
       at hudson.remoting.Request$2.run(Request.java:356)
       at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)
       Caused: java.util.concurrent.ExecutionException
       at hudson.remoting.Channel$2.adapt(Channel.java:942)
       at hudson.remoting.Channel$2.adapt(Channel.java:937)
       at hudson.remoting.FutureAdapter.get(FutureAdapter.java:59)
       at hudson.FilePath.copyRecursiveTo(FilePath.java:2224)
       Caused: java.io.IOException: Failed to extract /tmp/slave/workspace/test/transfer of 1 files
       at hudson.FilePath.readFromTar(FilePath.java:2317)
       at hudson.FilePath.copyRecursiveTo(FilePath.java:2221)
       at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61)
       at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:245)
       at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
       at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:736)
       at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:682)
       at hudson.model.Build$BuildExecution.post2(Build.java:186)
       at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:627)
       at hudson.model.Run.execute(Run.java:1749)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:421)
       Build step 'Archive the artifacts' changed build result to FAILURE
       Finished: FAILURE

      This happened on our production system, but I was able to reproduce it on a freshly installed jenkins instance with version 2.85 using this build script.

      echo foo > bar.txt
      sudo chown root bar.txt
      sudo chmod 600 bar.txt

      I have attached config.xml from my test job.

      The workaround is obviously to fix the permission issue on the slave, but I lost quite a few hours trying to debug this issue and a more appropriate error message would have helped quite a lot.

        1. config.xml
          1 kB
          Mattias Amnefelt

            Unassigned Unassigned
            mattiasa Mattias Amnefelt
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: