hudson.plugins.git.GitException: Failed to delete workspace

Jenkins JIRA | Matthaus Owens | 3 years ago
  1. 0

    Expected behavior: having "Wipe out workspace before build" unchecked would mean that the git plugin would not try to delete files in the workspace before building Actual behavior: having "Wipe out workspace before build" unchecked does not affect whether or not the git plugin tries to delete files in the workspace before building On version 1.5.0 of the git plugin (and judging by the source code, all versions since), the plugin unconditionally calls deleteContentsRecursive during the clone. This causes problems if the jenkins job running built any artifacts as another user, as they won't be able to be cleaned up. As there are checkboxes to indicate whether or not cleaning should occur, it seems like it would be nice to honor them. From src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java, line 366-370: {code} try { Util.deleteContentsRecursive(workspace); } catch (Exception e) { e.printStackTrace(listener.error("Failed to clean the workspace")); throw new GitException("Failed to delete workspace", e); } {code} When there are files not able to be deleted by jenkins, the following stacktrace is helpfully spewed: {code} ERROR: Failed to clean the workspace java.nio.file.AccessDeniedException: <REDACTED> at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1077) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.Util.deleteFile(Util.java:239) at hudson.Util.deleteRecursive(Util.java:307) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:222) at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2444) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) ERROR: Error cloning remote repo 'origin' : Failed to delete workspace hudson.plugins.git.GitException: Failed to delete workspace at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:225) at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2444) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.nio.file.AccessDeniedException: <REDACTED> at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1077) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.Util.deleteFile(Util.java:239) at hudson.Util.deleteRecursive(Util.java:307) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:222) ... 13 more {code}

    Jenkins JIRA | 3 years ago | Matthaus Owens
    hudson.plugins.git.GitException: Failed to delete workspace
  2. 0

    Expected behavior: having "Wipe out workspace before build" unchecked would mean that the git plugin would not try to delete files in the workspace before building Actual behavior: having "Wipe out workspace before build" unchecked does not affect whether or not the git plugin tries to delete files in the workspace before building On version 1.5.0 of the git plugin (and judging by the source code, all versions since), the plugin unconditionally calls deleteContentsRecursive during the clone. This causes problems if the jenkins job running built any artifacts as another user, as they won't be able to be cleaned up. As there are checkboxes to indicate whether or not cleaning should occur, it seems like it would be nice to honor them. From src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java, line 366-370: {code} try { Util.deleteContentsRecursive(workspace); } catch (Exception e) { e.printStackTrace(listener.error("Failed to clean the workspace")); throw new GitException("Failed to delete workspace", e); } {code} When there are files not able to be deleted by jenkins, the following stacktrace is helpfully spewed: {code} ERROR: Failed to clean the workspace java.nio.file.AccessDeniedException: <REDACTED> at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1077) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.Util.deleteFile(Util.java:239) at hudson.Util.deleteRecursive(Util.java:307) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:222) at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2444) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) ERROR: Error cloning remote repo 'origin' : Failed to delete workspace hudson.plugins.git.GitException: Failed to delete workspace at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:225) at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2444) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.nio.file.AccessDeniedException: <REDACTED> at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1077) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.Util.deleteFile(Util.java:239) at hudson.Util.deleteRecursive(Util.java:307) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at hudson.Util.deleteRecursive(Util.java:298) at hudson.Util.deleteContentsRecursive(Util.java:204) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:222) ... 13 more {code}

    Jenkins JIRA | 3 years ago | Matthaus Owens
    hudson.plugins.git.GitException: Failed to delete workspace
  3. 0

    Why C:\Windows\addins\FXSEXT.ecf accessed by Jenkins git plugin

    Stack Overflow | 1 year ago | Oleg Zhylin
    java.nio.file.AccessDeniedException: \windows\addins\FXSEXT.ecf
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.nio.file.AccessDeniedException at Jenkins build

    Stack Overflow | 10 months ago | marcelZ
    java.nio.file.AccessDeniedException: /Users/Shared/Jenkins/Home/jobs/my Project/workspace/./.svn/pristine/04/040d4cd4de48d844246c38e096a78718879bfafb.svn-base
  6. 0

    Fail to clean the workspace due to AccessDeniedException

    GitHub | 10 months ago | adelez
    java.nio.file.AccessDeniedException: /home/jenkins/workspace/gRPC_master/config/opt/language/sanity/platform/linux/gens/src/proto/grpc/lb/v0/load_balancer.pb.c

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.nio.file.AccessDeniedException

      <REDACTED>

      at sun.nio.fs.UnixException.translateToIOException()
    2. Java RT
      Method.invoke
      1. sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
      2. sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      3. sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      4. sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
      5. sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
      6. java.nio.file.Files.delete(Files.java:1077)
      7. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      8. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      9. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      10. java.lang.reflect.Method.invoke(Method.java:606)
      10 frames
    3. Hudson
      Util.deleteContentsRecursive
      1. hudson.Util.deleteFile(Util.java:239)
      2. hudson.Util.deleteRecursive(Util.java:307)
      3. hudson.Util.deleteContentsRecursive(Util.java:204)
      4. hudson.Util.deleteRecursive(Util.java:298)
      5. hudson.Util.deleteContentsRecursive(Util.java:204)
      6. hudson.Util.deleteRecursive(Util.java:298)
      7. hudson.Util.deleteContentsRecursive(Util.java:204)
      8. hudson.Util.deleteRecursive(Util.java:298)
      9. hudson.Util.deleteContentsRecursive(Util.java:204)
      10. hudson.Util.deleteRecursive(Util.java:298)
      11. hudson.Util.deleteContentsRecursive(Util.java:204)
      12. hudson.Util.deleteRecursive(Util.java:298)
      13. hudson.Util.deleteContentsRecursive(Util.java:204)
      14. hudson.Util.deleteRecursive(Util.java:298)
      15. hudson.Util.deleteContentsRecursive(Util.java:204)
      16. hudson.Util.deleteRecursive(Util.java:298)
      17. hudson.Util.deleteContentsRecursive(Util.java:204)
      18. hudson.Util.deleteRecursive(Util.java:298)
      19. hudson.Util.deleteContentsRecursive(Util.java:204)
      19 frames
    4. org.jenkinsci.plugins
      CliGitAPIImpl.clone
      1. org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:222)
      2. org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59)
      3. org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40)
      3 frames
    5. Hudson GIT plugin
      GitSCM$2.invoke
      1. hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
      2. hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
      2 frames
    6. Hudson
      FilePath$FileCallableWrapper.call
      1. hudson.FilePath$FileCallableWrapper.call(FilePath.java:2444)
      1 frame
    7. Hudson :: Remoting Layer
      InterceptingExecutorService$1.call
      1. hudson.remoting.UserRequest.perform(UserRequest.java:118)
      2. hudson.remoting.UserRequest.perform(UserRequest.java:48)
      3. hudson.remoting.Request$2.run(Request.java:326)
      4. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      4 frames
    8. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:262)
      2. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      4. java.lang.Thread.run(Thread.java:744)
      4 frames