- 
    Bug 
- 
    Resolution: Done
- 
    Critical 
- 
    None
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).
- is related to
- 
                    JENKINS-54225 Using disableDeferredWipeout within pipeline job results in no deleted workspace -         
- Resolved
 
-         
- relates to
- 
                    JENKINS-53740 Introduce a way how to disable deferred Wipeout -         
- Resolved
 
-