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

Unable to delete Workspace on SSH Slave with Pipeline

    Details

    • Similar Issues:

      Description

      Using Jenkins 2.157 and SSH Slaves Plugin 1.29.4 I'm not able anymore to clean a Workspace.

      Running the following simplified Pipeline twice leads in an error:

      node("MySlave") {
          stage("doSomething") {
              deleteDir()
              sh "touch test"
          }
      }
      
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (doSomething)
      [Pipeline] deleteDir
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      jenkins.util.io.CompositeIOException: Unable to remove directory /home/ubuntu/jenkins-slave/workspace/TestPipeline with directory contents: [/home/ubuntu/jenkins-slave/workspace/TestPipeline/test]
      	at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:233)
      	at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:191)
      	at jenkins.util.io.PathRemover.forceRemoveFile(PathRemover.java:71)
      	at hudson.Util.deleteFile(Util.java:255)
      	at hudson.FilePath.deleteRecursive(FilePath.java:1305)
      	at hudson.FilePath.access$1600(FilePath.java:213)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1274)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1270)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	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)
      java.nio.file.DirectoryNotEmptyException: /home/ubuntu/jenkins-slave/workspace/TestPipeline
      	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
      	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
      	at java.nio.file.Files.deleteIfExists(Files.java:1165)
      	at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:220)
      	at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:191)
      	at jenkins.util.io.PathRemover.forceRemoveFile(PathRemover.java:71)
      	at hudson.Util.deleteFile(Util.java:255)
      	at hudson.FilePath.deleteRecursive(FilePath.java:1305)
      	at hudson.FilePath.access$1600(FilePath.java:213)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1274)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1270)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	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)
      java.nio.file.DirectoryNotEmptyException: /home/ubuntu/jenkins-slave/workspace/TestPipeline
      	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
      	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
      	at java.nio.file.Files.deleteIfExists(Files.java:1165)
      	at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:224)
      	at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:191)
      	at jenkins.util.io.PathRemover.forceRemoveFile(PathRemover.java:71)
      	at hudson.Util.deleteFile(Util.java:255)
      	at hudson.FilePath.deleteRecursive(FilePath.java:1305)
      	at hudson.FilePath.access$1600(FilePath.java:213)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1274)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1270)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	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)
      Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to MySlave
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
      		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
      		at hudson.remoting.Channel.call(Channel.java:957)
      		at hudson.FilePath.act(FilePath.java:1072)
      		at hudson.FilePath.act(FilePath.java:1061)
      		at hudson.FilePath.deleteRecursive(FilePath.java:1268)
      		at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:77)
      		at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:69)
      		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
      		at hudson.security.ACL.impersonate(ACL.java:290)
      		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
      		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      Caused: java.io.IOException: Unable to delete '/home/ubuntu/jenkins-slave/workspace/TestPipeline'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
      	at jenkins.util.io.PathRemover.forceRemoveFile(PathRemover.java:75)
      	at hudson.Util.deleteFile(Util.java:255)
      	at hudson.FilePath.deleteRecursive(FilePath.java:1305)
      	at hudson.FilePath.access$1600(FilePath.java:213)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1274)
      	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1270)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	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)
      Finished: FAILURE
      

      Using Workspace Cleanup Plugin 0.37 works at least with test TestPipeline above, but I have a similar Error when checking out a Git Repo (containing a lot of subfolders).

        Attachments

          Issue Links

            Activity

            forster_ch Christoph Forster created issue -
            forster_ch Christoph Forster made changes -
            Field Original Value New Value
            Link This issue relates to JENKINS-53740 [ JENKINS-53740 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Component/s workflow-basic-steps-plugin [ 21712 ]
            Component/s ssh-slaves-plugin [ 15578 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Assignee Ivan Fernandez Calvo [ ifernandezcalvo ]
            pajasoft Pavel Janoušek made changes -
            Link This issue is related to JENKINS-54225 [ JENKINS-54225 ]
            forster_ch Christoph Forster made changes -
            Comment [ *UPDATE* Using Multibranch Pipelines: When deleting a branch the job is also not removed on Jenkins Slaves. ]
            forster_ch Christoph Forster made changes -
            Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
            Resolution Done [ 10000 ]
            ljbd Łukasz Dudek made changes -
            Comment [ We've started getting the same error on our CI machines tonight using Jenkins 2.163:
            {code:java}
            09:14:18 ERROR: Failed to clean the workspace 09:14:18 jenkins.util.io.CompositeIOException: Unable to delete '/home/mod-ci/ci/workspace/FW-Test_master-4XNYLCS76WQKTOSX2D7NZWLSHQ6GHIIMG7QVSSIVMEJJYTLC5LIQ'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
            {code} ]

              People

              • Assignee:
                Unassigned
                Reporter:
                forster_ch Christoph Forster
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: