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

Fix for JENKINS-9118 breaks archival if symlink referent is in the archive

    XMLWordPrintable

Details

    Description

      With the fix for JENKINS-9118, the archival process now attempts to preserve symlinks, but in doing so it now fails to archive if the referent of a symlink doesn't exist (yet). The problem is that it is apparently trying to chmod the symlink (which it shouldn't be doing to extract a symlink anyway) but that fails if the target of the symlink doesn't exist. In our case it was because the target was also in the archive and hadn't been extracted yet.

      Archiving artifacts
      ERROR: Failed to archive artifacts: linux86-deploy/*,solaris2-cross-linux86/*,test21/products/*,src/configuration/defaults/**/*,src/target/**/*
      hudson.util.IOException2: hudson.util.IOException2: Failed to extract /home/jarvis/probebuild/jenkins/workspace/Tools_Linux86_Solaris2_P44/linux86-deploy/*,solaris2-cross-linux86/*,test21/products/*,src/configuration/defaults/**/*,src/target/**/*
      	at hudson.FilePath.readFromTar(FilePath.java:1817)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1729)
      	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:116)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:625)
      	at hudson.model.Run.run(Run.java:1435)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:238)
      Caused by: java.io.IOException: Failed to chmod /home/hal/jenkins/home/jobs/Tools_Linux86_Solaris2_P44/builds/2012-03-28_16-02-44/archive/linux86-deploy/.bochsrc : No such file or directory
      	at hudson.FilePath._chmod(FilePath.java:1248)
      	at hudson.FilePath.readFromTar(FilePath.java:1813)
      	... 12 more
      
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1736)
      	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:116)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:625)
      	at hudson.model.Run.run(Run.java:1435)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:238)
      Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Pipe is already closed
      	at hudson.remoting.Channel$2.adapt(Channel.java:714)
      	at hudson.remoting.Channel$2.adapt(Channel.java:709)
      	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:59)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1732)
      	... 11 more
      Caused by: java.io.IOException: Pipe is already closed
      	at hudson.remoting.PipeWindow.checkDeath(PipeWindow.java:83)
      	at hudson.remoting.PipeWindow$Real.get(PipeWindow.java:171)
      	at hudson.remoting.ProxyOutputStream._write(ProxyOutputStream.java:118)
      	at hudson.remoting.ProxyOutputStream.write(ProxyOutputStream.java:103)
      	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
      	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
      	at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:178)
      	at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:135)
      	at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:89)
      	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
      	at org.apache.tools.tar.TarBuffer.writeBlock(TarBuffer.java:410)
      	at org.apache.tools.tar.TarBuffer.writeRecord(TarBuffer.java:351)
      	at hudson.org.apache.tools.tar.TarOutputStream.writeEOFRecord(TarOutputStream.java:356)
      	at hudson.org.apache.tools.tar.TarOutputStream.finish(TarOutputStream.java:137)
      	at hudson.org.apache.tools.tar.TarOutputStream.close(TarOutputStream.java:149)
      	at hudson.util.io.TarArchiver.close(TarArchiver.java:119)
      	at hudson.FilePath.writeToTar(FilePath.java:1783)
      	at hudson.FilePath.access$1000(FilePath.java:166)
      	at hudson.FilePath$36.invoke(FilePath.java:1722)
      	at hudson.FilePath$36.invoke(FilePath.java:1719)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2154)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:287)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:636)
      Caused by: java.io.IOException: Pipe is already closed
      	at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:147)
      	at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:131)
      	at hudson.remoting.ProxyOutputStream$Chunk$1.run(ProxyOutputStream.java:211)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	... 5 more
      Caused by: hudson.remoting.FastPipedInputStream$ClosedBy: The pipe was closed at...
      	at hudson.remoting.FastPipedInputStream.close(FastPipedInputStream.java:112)
      	at java.io.FilterInputStream.close(FilterInputStream.java:172)
      	at java.util.zip.InflaterInputStream.close(InflaterInputStream.java:227)
      	at java.util.zip.GZIPInputStream.close(GZIPInputStream.java:126)
      	at org.apache.tools.tar.TarBuffer.close(TarBuffer.java:456)
      	at hudson.org.apache.tools.tar.TarInputStream.close(TarInputStream.java:110)
      	at hudson.FilePath.readFromTar(FilePath.java:1824)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1729)
      	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:116)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:625)
      	at hudson.model.Run.run(Run.java:1435)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:238)
      

      Attachments

        Issue Links

          Activity

            bsm_ghs Brian Morris added a comment - - edited

            I am not familiar with the proper way to propose patches for git projects, nor have I attempted to compile Jenkins with this patch, but I believe this simple change would resolve this issue:

            --- FilePath.java.orig	2012-03-29 23:09:54.000000000 -0700
            +++ FilePath.java	2012-03-29 23:10:36.000000000 -0700
            @@ -1805,12 +1805,12 @@
                                     new FilePath(f).symlinkTo(te.getLinkName(), TaskListener.NULL);
                                 } else {
                                     IOUtils.copy(t,f);
            -                    }
                                 
            -                    f.setLastModified(te.getModTime().getTime());
            -                    int mode = te.getMode()&0777;
            -                    if(mode!=0 && !Functions.isWindows()) // be defensive
            -                        _chmod(f,mode);
            +                        f.setLastModified(te.getModTime().getTime());
            +                        int mode = te.getMode()&0777;
            +                        if(mode!=0 && !Functions.isWindows()) // be defensive
            +                            _chmod(f,mode);
            +                    }
                             }
                         }
                     } catch(IOException e) {
            
            bsm_ghs Brian Morris added a comment - - edited I am not familiar with the proper way to propose patches for git projects, nor have I attempted to compile Jenkins with this patch, but I believe this simple change would resolve this issue: --- FilePath.java.orig 2012-03-29 23:09:54.000000000 -0700 +++ FilePath.java 2012-03-29 23:10:36.000000000 -0700 @@ -1805,12 +1805,12 @@ new FilePath(f).symlinkTo(te.getLinkName(), TaskListener.NULL); } else { IOUtils.copy(t,f); - } - f.setLastModified(te.getModTime().getTime()); - int mode = te.getMode()&0777; - if (mode!=0 && !Functions.isWindows()) // be defensive - _chmod(f,mode); + f.setLastModified(te.getModTime().getTime()); + int mode = te.getMode()&0777; + if (mode!=0 && !Functions.isWindows()) // be defensive + _chmod(f,mode); + } } } } catch (IOException e) {
            bsm_ghs Brian Morris added a comment -

            I'm adding core to the components, since it seems like FilePath is part of the core even though JENKINS-9118 listed clone-workspace as the component.

            bsm_ghs Brian Morris added a comment - I'm adding core to the components, since it seems like FilePath is part of the core even though JENKINS-9118 listed clone-workspace as the component.
            njamesp Nick Parrish added a comment -

            This might be related to JENKINS-13202.

            njamesp Nick Parrish added a comment - This might be related to JENKINS-13202 .
            bsm_ghs Brian Morris added a comment -

            I would agree – that sounds like the exact same problem. I'm not sure if "ssh slave" is a requirement of the problem, but symlinks definitely are.

            bsm_ghs Brian Morris added a comment - I would agree – that sounds like the exact same problem. I'm not sure if "ssh slave" is a requirement of the problem, but symlinks definitely are.
            dreiss David Reiss added a comment -

            See JENKINS-13202 for fix details.

            dreiss David Reiss added a comment - See JENKINS-13202 for fix details.

            People

              abayer Andrew Bayer
              bsm_ghs Brian Morris
              Votes:
              14 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: