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

Downloading JDK from ZIP on Agent causes file not found error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not A Defect
    • core, remoting
    • None

    Description

      When installing a JDK as a global tool where the installable is a ZIP file, the installation fails on a remote agent but succeeds on the Jenkins master.

      Changing the ZIP file to a .tar.gz fixes the issues and works as expected on both master and agents.

      The remote agent in this case is a dynamic EC2 node.

       

       [Pipeline] tool Unpacking https://<artifactory>/somefile.zip to /home/jenkins-slave/tools/hudson.model.JDK/ibm-jdk7 on EC2 (Digital Slave - Dev) - build-application ()
       ERROR: Failed to download https://<artifactory>/somefile.zip from agent; will retry from master
       java.io.IOException: No such file or directory
       at java.io.UnixFileSystem.createFileExclusively(Native Method)
       at java.io.File.createTempFile(File.java:2026)
       at java.io.File.createTempFile(File.java:2072)
       at hudson.FilePath.unzip(FilePath.java:677)
       at hudson.FilePath.access$200(FilePath.java:213)
       at hudson.FilePath$Unpack.invoke(FilePath.java:1040)
       Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to EC2 (Digital Slave - Dev) - build-application)
       at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
       at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
       at hudson.remoting.Channel.call(Channel.java:1001)
       at hudson.FilePath.act(FilePath.java:1157)
       at hudson.FilePath.act(FilePath.java:1146)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1002)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
       at hudson.tools.ZipExtractionInstaller.performInstallation(ZipExtractionInstaller.java:83)
       at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
       at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
       at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
       at hudson.model.JDK.forNode(JDK.java:148)
       at hudson.model.JDK.forNode(JDK.java:60)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
       at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
       at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.lang.Thread.run(Thread.java:834)
       Caused: java.io.IOException: Failed to unpack https://<artifactory>/somefile.zip (0 bytes read)
       at hudson.FilePath$Unpack.invoke(FilePath.java:1045)
       at hudson.FilePath$Unpack.invoke(FilePath.java:1030)
       at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3313)
       at hudson.remoting.UserRequest.perform(UserRequest.java:211)
       at hudson.remoting.UserRequest.perform(UserRequest.java:54)
       at hudson.remoting.Request$2.run(Request.java:375)
       at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73)
       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)[Pipeline] }
       [Pipeline] // stage
       [Pipeline] }
       [Pipeline] // withEnv
       [Pipeline] }
       [Pipeline] // withEnv
       [Pipeline] }
       [Pipeline] // node
       [Pipeline] stage
       [Pipeline]
      { (Declarative: Post Actions) [Pipeline] echoBuild completed. currentBuild.result = FAILURE[Pipeline] echoBuild failedError when executing failure post condition: groovy.lang.MissingPropertyException: No such property: jobName for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270) at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:357) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:312) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.delegateAndExecute(ModelInterpreter.groovy:137) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:756) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:395) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:393) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:755) at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2030) at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2015) at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2056) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy:745) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.runPostConditions(ModelInterpreter.groovy) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executePostBuild(ModelInterpreter.groovy:723) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at jdk.internal.reflect.GeneratedMethodAccessor733.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) [Pipeline] }
      [Pipeline] // stage
       [Pipeline] End of Pipeline
       [Bitbucket] Notifying commit build result
       [Bitbucket] Build result notified
       Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to EC2 (Digital Slave - Dev) - build-application ()
       at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
       at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
       at hudson.remoting.Channel.call(Channel.java:1001)
       at hudson.FilePath.act(FilePath.java:1157)
       at hudson.FilePath.act(FilePath.java:1146)
       at hudson.FilePath.unzipFrom(FilePath.java:661)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1015)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
       at hudson.tools.ZipExtractionInstaller.performInstallation(ZipExtractionInstaller.java:83)
       at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
       at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
       at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
       at hudson.model.JDK.forNode(JDK.java:148)
       at hudson.model.JDK.forNode(JDK.java:60)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
       at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
       at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.lang.Thread.run(Thread.java:834)
       java.io.IOException: No such file or directory
       at java.io.UnixFileSystem.createFileExclusively(Native Method)
       at java.io.File.createTempFile(File.java:2026)
       at java.io.File.createTempFile(File.java:2072)
       at hudson.FilePath.unzip(FilePath.java:677)
       at hudson.FilePath.access$200(FilePath.java:213)
       at hudson.FilePath$UnzipFrom.invoke(FilePath.java:670)
       at hudson.FilePath$UnzipFrom.invoke(FilePath.java:663)
       at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3313)
       at hudson.remoting.UserRequest.perform(UserRequest.java:211)
       at hudson.remoting.UserRequest.perform(UserRequest.java:54)
       at hudson.remoting.Request$2.run(Request.java:375)
       at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73)
       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.io.IOException: Failed to unpack https://<artifactory>/somefile.zip
       (15239 bytes read of total 140949363)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1019)
       Caused: java.io.IOException: Failed to install https://<artifactory>/somefile.zip
       to /home/jenkins-slave/tools/hudson.model.JDK/ibm-jdk7
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1025)
       at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
       at hudson.tools.ZipExtractionInstaller.performInstallation(ZipExtractionInstaller.java:83)
       at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
       at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
       at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
       at hudson.model.JDK.forNode(JDK.java:148)
       at hudson.model.JDK.forNode(JDK.java:60)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
       at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
       at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
       at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.lang.Thread.run(Thread.java:834)
       Finished: FAILURE
        
      

       

      Attachments

        Activity

          timja Tim Jacomb added a comment -

          cc danielbeck possible security release regression

          timja Tim Jacomb added a comment - cc danielbeck possible security release regression
          danielbeck Daniel Beck added a comment -

          stetchy Did this work in older releases of Jenkins?

          danielbeck Daniel Beck added a comment - stetchy Did this work in older releases of Jenkins?
          jthompson Jeff Thompson added a comment - - edited

          It looks like a failed or possibly incomplete download of the file from the provided URL.
          "Failed to download https://<artifactory>/somefile.zip from agent;"
          "java.io.IOException: No such file or directory"
          "Caused: java.io.IOException: Failed to unpack https://<artifactory>/somefile.zip (0 bytes read)"
           

          I see where the message
          "Failed to download https://<artifactory>/somefile.zip from agent; will retry from master"
          comes from, but I haven't experienced it before. It looks like this should have been the agent side attempt, but we don't see the following retry from the master in this report.

          jthompson Jeff Thompson added a comment - - edited It looks like a failed or possibly incomplete download of the file from the provided URL. "Failed to download https://<artifactory>/somefile.zip from agent;" "java.io.IOException: No such file or directory" "Caused: java.io.IOException: Failed to unpack https://<artifactory>/somefile.zip (0 bytes read)"   I see where the message "Failed to download https://<artifactory>/somefile.zip from agent; will retry from master" comes from, but I haven't experienced it before. It looks like this should have been the agent side attempt, but we don't see the following retry from the master in this report.
          jthompson Jeff Thompson added a comment - - edited

          I've got a very limited replication that seems to work fine. I used a controller and agent setup I have locally.

          I adapted a simple example to look like this

          pipeline {
              agent {
                  node {
                  label 'mynode'
                  }
              }
              
              tools { 
                  jdk 'Java 1.8' 
              }
              stages {
                  stage ('Run') {
                      steps {
                          sh '''
                              echo 'Do something here'
                          ''' 
                      }
                  }
              }
          }
          

          I set up "Java 1.8" global tool installation with a publicly available zip JDK download URL.

          Everything gets unzipped and appears to work fine.

           

          jthompson Jeff Thompson added a comment - - edited I've got a very limited replication that seems to work fine. I used a controller and agent setup I have locally. I adapted a simple example to look like this pipeline { agent { node { label 'mynode' } } tools { jdk 'Java 1.8' } stages { stage ( 'Run' ) { steps { sh ''' echo 'Do something here' ''' } } } } I set up "Java 1.8" global tool installation with a publicly available zip JDK download URL. Everything gets unzipped and appears to work fine.  
          jthompson Jeff Thompson added a comment -

          stetchy, after answering Daniel's question, if this is still an issue could you provide further information about your configuration and results? These might include  a minimal pipeline that demonstrates the behavior, further specifics about the agent environment that demonstrates the problem, or any further useful reproduction information. Also, could you check that the URL is fully accessible from the agent?

          jthompson Jeff Thompson added a comment - stetchy , after answering Daniel's question, if this is still an issue could you provide further information about your configuration and results? These might include  a minimal pipeline that demonstrates the behavior, further specifics about the agent environment that demonstrates the problem, or any further useful reproduction information. Also, could you check that the URL is fully accessible from the agent?
          stetchy Riain Condon added a comment -

          danielbeck I came across this when building a new Jenkins on LTS so not sure about previous versions. I'll spin up a couple instances on the last two LTS versions tomorrow and let you know if same persists.

          jeffret The agents used are dynamic EC2 agents provisioned with ec2-plugin, it could be an issue stemming from that rather than normal agents. Yeah URL is fully accessible, a Maven installation using a tar.gz on the same domain installed fine on the agent as part of the same build.

          stetchy Riain Condon added a comment - danielbeck I came across this when building a new Jenkins on LTS so not sure about previous versions. I'll spin up a couple instances on the last two LTS versions tomorrow and let you know if same persists. jeffret The agents used are dynamic EC2 agents provisioned with ec2-plugin, it could be an issue stemming from that rather than normal agents. Yeah URL is fully accessible, a Maven installation using a tar.gz on the same domain installed fine on the agent as part of the same build.
          danielbeck Daniel Beck added a comment - - edited

          java.io.IOException: No such file or directory

          Would be interesting to know what the temp dir is on the agent, and whether the agent process can write to it / mkdirs there.

          danielbeck Daniel Beck added a comment - - edited java.io.IOException: No such file or directory Would be interesting to know what the temp dir is on the agent, and whether the agent process can write to it / mkdirs there.
          jthompson Jeff Thompson added a comment -

          Thanks for clarifying stetchy . It would be great if you can determine any more about what is going on here.

          It shouldn't have anything to do with recent changes. There were changes involving zip, but none that should have affected unzip. It's especially weird that tar.gz works but zip doesn't as they go through very similar code paths.

          jthompson Jeff Thompson added a comment - Thanks for clarifying stetchy . It would be great if you can determine any more about what is going on here. It shouldn't have anything to do with recent changes. There were changes involving zip, but none that should have affected unzip. It's especially weird that tar.gz works but zip doesn't as they go through very similar code paths.
          stetchy Riain Condon added a comment -

          danielbeck I'll have a look and see where the temp directory is. It's strange though that the Maven install works fine, it is a tar though. I'll see if changing it to a zip results in the same.

          jeffret Yeah. I noticed in the logs that when the first error occurs it says it is at zero bytes downloaded, then the second printing of the error has a > 0 amount of bytes retrieved. It's hardly trying to prematurely expand the zip file on the remote is it?

          stetchy Riain Condon added a comment - danielbeck I'll have a look and see where the temp directory is. It's strange though that the Maven install works fine, it is a tar though. I'll see if changing it to a zip results in the same. jeffret Yeah. I noticed in the logs that when the first error occurs it says it is at zero bytes downloaded, then the second printing of the error has a > 0 amount of bytes retrieved. It's hardly trying to prematurely expand the zip file on the remote is it?
          danielbeck Daniel Beck added a comment -

          It's strange though that the Maven install works fine, it is a tar though.

          Not strange: Untaring doesn't go through a file in the temp dir.

          danielbeck Daniel Beck added a comment - It's strange though that the Maven install works fine, it is a tar though. Not strange: Untaring doesn't go through a file in the temp dir.
          stetchy Riain Condon added a comment -

          danielbeck you were spot on with the temp dir. We specified it via a JVM argument and the creation of the dir didn't succeed in the AMI bake, so it caused the error above. Sorry for the red herring

          stetchy Riain Condon added a comment - danielbeck  you were spot on with the temp dir. We specified it via a JVM argument and the creation of the dir didn't succeed in the AMI bake, so it caused the error above. Sorry for the red herring
          danielbeck Daniel Beck added a comment -

          Glad you found the cause.

          danielbeck Daniel Beck added a comment - Glad you found the cause.

          People

            jthompson Jeff Thompson
            stetchy Riain Condon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: