I see that issue happening on long paths. A workaround was to use drive mapping in order to reduce the length but it doesn't solve the issue and we came to the limit of path shortening possibilities.

      Here's a stacktrace from a Matrix job:
      https://qa.nuxeo.org/jenkins/job/nuxeo-master-fullbuild-part2-distribution-multios/218/Slave=MULTIDB_WINDOWS

      08:59:26 Building remotely on tweedledum in workspace C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS
      08:59:26 Checkout:MULTIDB_WINDOWS / C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS - hudson.remoting.Channel@4a58a509:tweedledum
      08:59:26 Using strategy: Default
      08:59:26 Last Built Revision: Revision 3676821964588c85aa8b71e288c743c24edd00a3 (origin/master)
      08:59:27 Cloning the remote Git repository
      08:59:27 Cloning repository git://github.com/nuxeo/nuxeo-distribution.git
      08:59:27 git --version
      08:59:27 git version 1.7.6.msysgit.0
      08:59:27 ERROR: Failed to clean the workspace
      08:59:27 java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
      08:59:27 	at hudson.Util.deleteFile(Util.java:238)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:289)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.FilePath$11.invoke(FilePath.java:910)
      08:59:27 	at hudson.FilePath$11.invoke(FilePath.java:908)
      08:59:27 	at hudson.FilePath.act(FilePath.java:842)
      08:59:27 	at hudson.FilePath.act(FilePath.java:824)
      08:59:27 	at hudson.FilePath.deleteRecursive(FilePath.java:908)
      08:59:27 	at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
      08:59:27 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      08:59:27 	at hudson.remoting.Request$2.run(Request.java:326)
      08:59:27 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      08:59:27 	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      08:59:27 	at java.util.concurrent.FutureTask.run(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      08:59:27 	at hudson.remoting.Engine$1$1.run(Engine.java:60)
      08:59:27 	at java.lang.Thread.run(Unknown Source)
      08:59:27 ERROR: Error cloning remote repo 'origin' : Failed to delete workspace
      08:59:27 hudson.plugins.git.GitException: Failed to delete workspace
      08:59:27 	at hudson.plugins.git.GitAPI.clone(GitAPI.java:242)
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
      08:59:27 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      08:59:27 	at hudson.remoting.Request$2.run(Request.java:326)
      08:59:27 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      08:59:27 	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      08:59:27 	at java.util.concurrent.FutureTask.run(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      08:59:27 	at hudson.remoting.Engine$1$1.run(Engine.java:60)
      08:59:27 	at java.lang.Thread.run(Unknown Source)
      08:59:27 Caused by: java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
      08:59:27 	at hudson.Util.deleteFile(Util.java:238)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:289)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.Util.deleteContentsRecursive(Util.java:200)
      08:59:27 	at hudson.Util.deleteRecursive(Util.java:280)
      08:59:27 	at hudson.FilePath$11.invoke(FilePath.java:910)
      08:59:27 	at hudson.FilePath$11.invoke(FilePath.java:908)
      08:59:27 	at hudson.FilePath.act(FilePath.java:842)
      08:59:27 	at hudson.FilePath.act(FilePath.java:824)
      08:59:27 	at hudson.FilePath.deleteRecursive(FilePath.java:908)
      08:59:27 	at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
      08:59:27 	... 13 more
      08:59:27 Trying next repository
      08:59:27 ERROR: Could not clone repository
      08:59:27 FATAL: Could not clone
      08:59:27 hudson.plugins.git.GitException: Could not clone
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1052)
      08:59:27 	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
      08:59:27 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      08:59:27 	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      08:59:27 	at hudson.remoting.Request$2.run(Request.java:326)
      08:59:27 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      08:59:27 	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      08:59:27 	at java.util.concurrent.FutureTask.run(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      08:59:27 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      08:59:27 	at hudson.remoting.Engine$1$1.run(Engine.java:60)
      08:59:27 	at java.lang.Thread.run(Unknown Source)
      

      It is still possible to manually delete the files.

      FYI, we encountered such a seemingly similar issue in a Python script using Python internal delTree implementation, and it has been resolved by using Windows Shell command: "rmdir /s /q path/to/file" instead.

      Using a matrix job is increasing the path length.
      We would also need to use a different workspace path when under Windows.

          [JENKINS-15418] Fails to clean windows workspace with long path

          Julien Carsique created issue -
          Julien Carsique made changes -
          Labels Original: git matrix path windows New: matrix path windows
          Julien Carsique made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: git [ 15543 ]
          URL Original: https://qa.nuxeo.org/jenkins/job/nuxeo-master-fullbuild-part2-distribution-multios
          Description Original: I see that issue happening on long paths. A workaround was to use drive mapping in order to reduce the length but it doesn't solve the issue and we came to the limit of path shortening possibilities.

          Here's a stacktrace from a Matrix job:
          https://qa.nuxeo.org/jenkins/job/nuxeo-master-fullbuild-part2-distribution-multios/218/Slave=MULTIDB_WINDOWS
          {code}08:59:26 Building remotely on tweedledum in workspace C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS
          08:59:26 Checkout:MULTIDB_WINDOWS / C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS - hudson.remoting.Channel@4a58a509:tweedledum
          08:59:26 Using strategy: Default
          08:59:26 Last Built Revision: Revision 3676821964588c85aa8b71e288c743c24edd00a3 (origin/master)
          08:59:27 Cloning the remote Git repository
          08:59:27 Cloning repository git://github.com/nuxeo/nuxeo-distribution.git
          08:59:27 git --version
          08:59:27 git version 1.7.6.msysgit.0
          08:59:27 ERROR: Failed to clean the workspace
          08:59:27 java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
          08:59:27 at hudson.Util.deleteFile(Util.java:238)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:289)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:910)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:908)
          08:59:27 at hudson.FilePath.act(FilePath.java:842)
          08:59:27 at hudson.FilePath.act(FilePath.java:824)
          08:59:27 at hudson.FilePath.deleteRecursive(FilePath.java:908)
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          08:59:27 ERROR: Error cloning remote repo 'origin' : Failed to delete workspace
          08:59:27 hudson.plugins.git.GitException: Failed to delete workspace
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:242)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          08:59:27 Caused by: java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
          08:59:27 at hudson.Util.deleteFile(Util.java:238)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:289)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:910)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:908)
          08:59:27 at hudson.FilePath.act(FilePath.java:842)
          08:59:27 at hudson.FilePath.act(FilePath.java:824)
          08:59:27 at hudson.FilePath.deleteRecursive(FilePath.java:908)
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
          08:59:27 ... 13 more
          08:59:27 Trying next repository
          08:59:27 ERROR: Could not clone repository
          08:59:27 FATAL: Could not clone
          08:59:27 hudson.plugins.git.GitException: Could not clone
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1052)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          {code}

          It is still possible to manually delete the files.

          FYI, we encountered such a seemingly similar issue in a Python script using Python internal delTree implementation, and it has been resolved by using Windows Shell command: "rmdir /s /q path/to/file" instead.

          Also, find attached the job's config.xml if it can help to look at the parameters.
          New: I see that issue happening on long paths. A workaround was to use drive mapping in order to reduce the length but it doesn't solve the issue and we came to the limit of path shortening possibilities.

          Here's a stacktrace from a Matrix job:
          https://qa.nuxeo.org/jenkins/job/nuxeo-master-fullbuild-part2-distribution-multios/218/Slave=MULTIDB_WINDOWS
          {code}08:59:26 Building remotely on tweedledum in workspace C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS
          08:59:26 Checkout:MULTIDB_WINDOWS / C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS - hudson.remoting.Channel@4a58a509:tweedledum
          08:59:26 Using strategy: Default
          08:59:26 Last Built Revision: Revision 3676821964588c85aa8b71e288c743c24edd00a3 (origin/master)
          08:59:27 Cloning the remote Git repository
          08:59:27 Cloning repository git://github.com/nuxeo/nuxeo-distribution.git
          08:59:27 git --version
          08:59:27 git version 1.7.6.msysgit.0
          08:59:27 ERROR: Failed to clean the workspace
          08:59:27 java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
          08:59:27 at hudson.Util.deleteFile(Util.java:238)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:289)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:910)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:908)
          08:59:27 at hudson.FilePath.act(FilePath.java:842)
          08:59:27 at hudson.FilePath.act(FilePath.java:824)
          08:59:27 at hudson.FilePath.deleteRecursive(FilePath.java:908)
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          08:59:27 ERROR: Error cloning remote repo 'origin' : Failed to delete workspace
          08:59:27 hudson.plugins.git.GitException: Failed to delete workspace
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:242)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          08:59:27 Caused by: java.io.IOException: Unable to delete C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management - files in dir: [C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.properties, C:\Jenkins\workspace\nuxeo-master-fullbuild-part2-distribution-multios\Slave\MULTIDB_WINDOWS\nuxeo-distribution-jboss\target\nuxeo-cap-5.7-SNAPSHOT-jboss\server\default\deploy\jbossws.sar\jbossws-management.war\META-INF\maven\org.jboss.ws.native\jbossws-native-management\pom.xml]
          08:59:27 at hudson.Util.deleteFile(Util.java:238)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:289)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.Util.deleteContentsRecursive(Util.java:200)
          08:59:27 at hudson.Util.deleteRecursive(Util.java:280)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:910)
          08:59:27 at hudson.FilePath$11.invoke(FilePath.java:908)
          08:59:27 at hudson.FilePath.act(FilePath.java:842)
          08:59:27 at hudson.FilePath.act(FilePath.java:824)
          08:59:27 at hudson.FilePath.deleteRecursive(FilePath.java:908)
          08:59:27 at hudson.plugins.git.GitAPI.clone(GitAPI.java:239)
          08:59:27 ... 13 more
          08:59:27 Trying next repository
          08:59:27 ERROR: Could not clone repository
          08:59:27 FATAL: Could not clone
          08:59:27 hudson.plugins.git.GitException: Could not clone
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1052)
          08:59:27 at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
          08:59:27 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          08:59:27 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          08:59:27 at hudson.remoting.Request$2.run(Request.java:326)
          08:59:27 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          08:59:27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          08:59:27 at java.util.concurrent.FutureTask.run(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          08:59:27 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          08:59:27 at hudson.remoting.Engine$1$1.run(Engine.java:60)
          08:59:27 at java.lang.Thread.run(Unknown Source)
          {code}

          It is still possible to manually delete the files.

          FYI, we encountered such a seemingly similar issue in a Python script using Python internal delTree implementation, and it has been resolved by using Windows Shell command: "rmdir /s /q path/to/file" instead.

          Using a matrix job is increasing the path length.
          We would also need to use a different workspace path when under Windows.
          Priority Original: Major [ 3 ] New: Minor [ 4 ]
          Summary Original: Git fails to clean windows workspace with long path New: Fails to clean windows workspace with long path
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Andreas Zschorn made changes -
          Link New: This issue is duplicated by JENKINS-14808 [ JENKINS-14808 ]
          Jesse Glick made changes -
          Labels Original: matrix path windows New: 1.480.4-candidate matrix path windows
          Jesse Glick made changes -
          Labels Original: 1.480.4-candidate matrix path windows New: lts-candidate matrix path windows
          vjuranek made changes -
          Labels Original: lts-candidate matrix path windows New: 1.509.1-fixed matrix path windows
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 146152 ] New: JNJira + In-Review [ 191801 ]

            ndeloof Nicolas De Loof
            jcarsique Julien Carsique
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: