Issue with maven jobs running on slaves (linux). The maven run completes successfully, but not sure why Jenkins tries to archive files from the maven project after maven run completes. This is where the Jenkins job fails when attempting to archive these project files as indicated by the stacktrace below. But when the same job runs on the master (linux), it builds just fine.

      Waiting for Jenkins to finish collecting data

      [JENKINS] Archiving /var/lib/jenkins/workspace/company-abc/test-project/pom.xml to com.companyabc/test-project/1.1.1/test-project-1.1.1.pom
      [JENKINS] Archiving /var/lib/jenkins/workspace/company-abc/test-project/target/test-project-1.1.1.jar to com.companyabc/test-project/1.1.1/test-project-1.1.1.jar
      channel stopped
      ERROR: Failed to parse POMs
      java.io.IOException: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /var/lib/jenkins/workspace/company-abc/test-project/target/test-project-1.1.1.jar ENOENT
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2016)
      	at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:57)
      	at hudson.maven.MavenBuild$ProxyImpl.performArchiving(MavenBuild.java:471)
      	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:835)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566)
      	at hudson.model.Run.execute(Run.java:1678)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:231)
      Caused by: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /var/lib/jenkins/workspace/company-abc/test-project/target/test-project-1.1.1.jar ENOENT
      	at hudson.remoting.Channel$3.adapt(Channel.java:755)
      	at hudson.remoting.Channel$3.adapt(Channel.java:750)
      	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:55)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2014)
      	... 8 more
      Caused by: hudson.os.PosixException: native error calling stat: No such file or directory /var/lib/jenkins/workspace/company-abc/test-project/target/test-project-1.1.1.jar ENOENT
      	at hudson.os.PosixAPI$1.error(PosixAPI.java:35)
      	at jnr.posix.LinuxPOSIX.stat(LinuxPOSIX.java:117)
      	at jnr.posix.CheckedPOSIX.stat(CheckedPOSIX.java:265)
      	at jnr.posix.LazyPOSIX.stat(LazyPOSIX.java:267)
      	at hudson.util.IOUtils.mode(IOUtils.java:125)
      	at hudson.util.io.TarArchiver.visit(TarArchiver.java:101)company-abc
      	at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
      	at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2540)
      	at hudson.FilePath.writeToTar(FilePath.java:2052)
      	at hudson.FilePath.access$1000(FilePath.java:172)
      	at hudson.FilePath$41.invoke(FilePath.java:1993)
      	at hudson.FilePath$41.invoke(FilePath.java:1989)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2461)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:328)
      	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:679)
      

          [JENKINS-21426] ENOENT during archiving artifacts

          kai tea added a comment -

          I forgot to mention I am currently on the latest Jenkins: 1.547

          kai tea added a comment - I forgot to mention I am currently on the latest Jenkins: 1.547

          Andrew Bayer added a comment -

          Seeing this for one of our jobs on 1.532.2 as well.

          Andrew Bayer added a comment - Seeing this for one of our jobs on 1.532.2 as well.

          Andrew Bayer added a comment -

          So in at least the case I'm able to inspect right now, it looks like the file it's barfing on legitimately doesn't exist at this point - maybe we should be checking for file existence in hudson.FilePath$ExplicitlySpecifiedDirScanner.scan, in case the file existed when the file listing was done but no longer exists by this time?

          Andrew Bayer added a comment - So in at least the case I'm able to inspect right now, it looks like the file it's barfing on legitimately doesn't exist at this point - maybe we should be checking for file existence in hudson.FilePath$ExplicitlySpecifiedDirScanner.scan, in case the file existed when the file listing was done but no longer exists by this time?

          Andrew Bayer added a comment -

          Assigning to kohsuke for his thoughts - also pinging jglick to see if he has anything.

          Andrew Bayer added a comment - Assigning to kohsuke for his thoughts - also pinging jglick to see if he has anything.

          Ken Koster added a comment -

          This issue may come from the git plugin "Clean before checkout" feature. I was seeing this exact error with that setting turned on, with Jenkins 1.522 and Jenkins Git Plugin 2.2.1. Since turning off the cleaning setting, the ENOENT error hasn't come back (yet).

          Ken Koster added a comment - This issue may come from the git plugin "Clean before checkout" feature. I was seeing this exact error with that setting turned on, with Jenkins 1.522 and Jenkins Git Plugin 2.2.1. Since turning off the cleaning setting, the ENOENT error hasn't come back (yet).

          Ian Blue added a comment -

          Hi, has anybody found a solution for this issue? I am experiencing the same and couldn't find a working solution.

          Ian Blue added a comment - Hi, has anybody found a solution for this issue? I am experiencing the same and couldn't find a working solution.

          I am seeing this same basic error using the pipeline-maven-plugin as follows:

          node('linux'){
              //Our cusome wrapper around checkout
              GitClient.checkoutRepo('DEP/cd-build-deploy-validation') 
          
              withMaven( maven: 'mvn-3.3.9') {
          
                  // Run the maven build
                  sh "mvn -B -s /home/jenkins/.m2/settings.xml -U clean deploy -Prelease,jenkins -DperformRelease=true"
              
              }
          }

          Build succeeds but am getting this in the logs:

          java.io.IOException: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT
          	at hudson.FilePath.copyRecursiveTo(FilePath.java:2253)
          	at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61)
          	at org.jenkinsci.plugins.pipeline.maven.reporters.GeneratedArtifactsReporter.process(GeneratedArtifactsReporter.java:97)
          	at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:94)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution$Callback.finished(WithMavenStepExecution.java:770)
          	at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114)
          	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:362)
          	at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73)
          	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
          	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
          	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
          	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
          	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
          	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          	at java.lang.Thread.run(Thread.java:745)
          Caused by: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT
          	at hudson.remoting.Channel$2.adapt(Channel.java:829)
          	at hudson.remoting.Channel$2.adapt(Channel.java:824)
          	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:55)
          	at hudson.FilePath.copyRecursiveTo(FilePath.java:2251)
          	... 27 more
          Caused by: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT
          	at hudson.os.PosixAPI$1.error(PosixAPI.java:36)
          	at jnr.posix.LinuxPOSIX.stat(LinuxPOSIX.java:117)
          	at jnr.posix.CheckedPOSIX.stat(CheckedPOSIX.java:265)
          	at jnr.posix.LazyPOSIX.stat(LazyPOSIX.java:267)
          	at hudson.util.IOUtils.mode(IOUtils.java:128)
          	at hudson.util.io.TarArchiver.visit(TarArchiver.java:89)
          	at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
          	at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2845)
          	at hudson.FilePath.writeToTar(FilePath.java:2289)
          	at hudson.FilePath.access$2100(FilePath.java:195)
          	at hudson.FilePath$45.invoke(FilePath.java:2230)
          	at hudson.FilePath$45.invoke(FilePath.java:2226)
          	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
          	at hudson.remoting.Request$2.run(Request.java:332)
          	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          	at java.lang.Thread.run(Thread.java:745)
          	at ......remote call to sv20-jenlin-005(Native Method)
          	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1433)
          	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
          	at hudson.remoting.Channel$2.adapt(Channel.java:827)
           

          This is with Jenkins 2.19.3, pipeline plugin 2.4 and maven-pipeline-plugin 2.0

          Kenneth Baltrinic added a comment - I am seeing this same basic error using the pipeline-maven-plugin as follows: node( 'linux' ){ //Our cusome wrapper around checkout GitClient.checkoutRepo( 'DEP/cd-build-deploy-validation' ) withMaven( maven: 'mvn-3.3.9' ) { // Run the maven build sh "mvn -B -s /home/jenkins/.m2/settings.xml -U clean deploy -Prelease,jenkins -DperformRelease= true " } } Build succeeds but am getting this in the logs: java.io.IOException: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT at hudson.FilePath.copyRecursiveTo(FilePath.java:2253) at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61) at org.jenkinsci.plugins.pipeline.maven.reporters.GeneratedArtifactsReporter.process(GeneratedArtifactsReporter.java:97) at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:94) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution$Callback.finished(WithMavenStepExecution.java:770) at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114) at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:362) at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) Caused by: java.util.concurrent.ExecutionException: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT at hudson.remoting.Channel$2.adapt(Channel.java:829) at hudson.remoting.Channel$2.adapt(Channel.java:824) at hudson.remoting.FutureAdapter.get(FutureAdapter.java:55) at hudson.FilePath.copyRecursiveTo(FilePath.java:2251) ... 27 more Caused by: hudson.os.PosixException: native error calling stat: No such file or directory /home/jenkins/workspace/ken-pipeline-sandbox/jenkins/workspace/ken-pipeline-sandbox/cd-build-deploy-validation-api/target/cd-build-deploy-validation-api-1.0.0-SNAPSHOT.jar ENOENT at hudson.os.PosixAPI$1.error(PosixAPI.java:36) at jnr.posix.LinuxPOSIX.stat(LinuxPOSIX.java:117) at jnr.posix.CheckedPOSIX.stat(CheckedPOSIX.java:265) at jnr.posix.LazyPOSIX.stat(LazyPOSIX.java:267) at hudson.util.IOUtils.mode(IOUtils.java:128) at hudson.util.io.TarArchiver.visit(TarArchiver.java:89) at hudson.util.DirScanner.scanSingle(DirScanner.java:49) at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2845) at hudson.FilePath.writeToTar(FilePath.java:2289) at hudson.FilePath.access$2100(FilePath.java:195) at hudson.FilePath$45.invoke(FilePath.java:2230) at hudson.FilePath$45.invoke(FilePath.java:2226) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:332) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) at ......remote call to sv20-jenlin-005(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1433) at hudson.remoting.UserResponse.retrieve(UserRequest.java:253) at hudson.remoting.Channel$2.adapt(Channel.java:827)   This is with Jenkins 2.19.3, pipeline plugin 2.4 and maven-pipeline-plugin 2.0

          Purely by luck I found a workaround to my case. Adding -f $WORKSPACE/pom.xml to the mvn command line fixed the issue.

          e.g.

          sh "mvn -B -s $HOME/.m2/settings.xml -f $WORKSPACE/pom.xml -U clean deploy -Prelease,jenkins -DperformRelease=true"
          

          Kenneth Baltrinic added a comment - Purely by luck I found a workaround to my case. Adding -f $WORKSPACE/pom.xml to the mvn command line fixed the issue. e.g. sh "mvn -B -s $HOME/.m2/settings.xml -f $WORKSPACE/pom.xml -U clean deploy -Prelease,jenkins -DperformRelease= true "

          kbaltrinic do you reproduce this bug? I didn't see this problem happening anywhere

          Cyrille Le Clerc added a comment - kbaltrinic do you reproduce this bug? I didn't see this problem happening anywhere

          Benoit added a comment -

          kbaltrinic what do your `release` profile and `performRelease=true` env var hide ? Is this single maven command line doing the whole release process : ie change pom to strip SNAPSHOT, then deploy the fixed version, and then changing pom again to increment version ?

          Benoit added a comment - kbaltrinic what do your `release` profile and `performRelease=true` env var hide ? Is this single maven command line doing the whole release process : ie change pom to strip SNAPSHOT, then deploy the fixed version, and then changing pom again to increment version ?

            Unassigned Unassigned
            kaitea2005 kai tea
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: