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

java.nio.file.DirectoryNotEmptyException: /home/dev/.jenkins/jobs/MyBuild/lastSuccessful

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hello,

      On the latest version 1.546 for a maven build I get this error:

      Started by user anonymous
      ln builds/lastSuccessfulBuild /home/dev/.jenkins/jobs/MyBuild/lastSuccessful failed
      java.nio.file.DirectoryNotEmptyException: /home/dev/.jenkins/jobs/MyBuild/lastSuccessful
      	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:241)
      	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
      	at java.nio.file.Files.deleteIfExists(Files.java:1116)
      	at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at hudson.Util.createSymlinkJava7(Util.java:1146)
      	at hudson.Util.createSymlink(Util.java:1064)
      	at hudson.model.Run.createSymlink(Run.java:1783)
      	at hudson.model.Run.updateSymlinks(Run.java:1764)
      	at hudson.model.Run.execute(Run.java:1676)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:231)
      ln builds/lastStableBuild /home/dev/.jenkins/jobs/MyBuild/lastStable failed
      java.nio.file.DirectoryNotEmptyException: /home/dev/.jenkins/jobs/MyBuild/lastStable
      	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:241)
      	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
      	at java.nio.file.Files.deleteIfExists(Files.java:1116)
      	at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at hudson.Util.createSymlinkJava7(Util.java:1146)
      	at hudson.Util.createSymlink(Util.java:1064)
      	at hudson.model.Run.createSymlink(Run.java:1783)
      	at hudson.model.Run.updateSymlinks(Run.java:1765)
      	at hudson.model.Run.execute(Run.java:1676)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:231)
      Building in workspace /home/dev/.jenkins/jobs/MyBuild/workspace
      Updating svn://myweb.com/repos/Events/trunk at revision '2014-01-10T15:06:09.745 +0000'
      At revision 1974
      WARNING: clock of the subversion server appears to be out of sync. This can result in inconsistent check out behavior.
      no change for svn://myweb.com/repos/Events/trunk since the previous build
      Parsing POMs
      

      It does not seem to get the latest update from the svn.

      Switching back to 1.544 fixed the issue.

      Cheers Greg

        Attachments

          Activity

          Hide
          haridsv Hari Dara added a comment -

          This started happening on a new Jenkins server that a teammate was trying to setup by cloning an existing one, and I found out that he used scp -r to copy the whole working tree and that resulted in the lastSuccessful and lastStable soft-links to get converted to physical directories. I guess Jenkins was trying to remove it like it is a file (which a soft-link is), but since it turned out to be a directory that is not empty, it is causing this exception. When you remove/rename these directories, it clears the path for Jenkins to recreate the soft-links thus solving the problem.

          Perhaps Jenkins can handle this case more gracefully?

          Show
          haridsv Hari Dara added a comment - This started happening on a new Jenkins server that a teammate was trying to setup by cloning an existing one, and I found out that he used scp -r to copy the whole working tree and that resulted in the lastSuccessful and lastStable soft-links to get converted to physical directories. I guess Jenkins was trying to remove it like it is a file (which a soft-link is), but since it turned out to be a directory that is not empty, it is causing this exception. When you remove/rename these directories, it clears the path for Jenkins to recreate the soft-links thus solving the problem. Perhaps Jenkins can handle this case more gracefully?
          Hide
          jglick Jesse Glick added a comment -

          `createSymlinkJava7` could detect this case and either report the real mistake, or simply delete the bogus directory.

          Show
          jglick Jesse Glick added a comment - `createSymlinkJava7` could detect this case and either report the real mistake, or simply delete the bogus directory.
          Hide
          haridsv Hari Dara added a comment -

          Looks like this issue got fixed in the change d97b083. @kohsuke

          Show
          haridsv Hari Dara added a comment - Looks like this issue got fixed in the change d97b083 . @kohsuke
          Hide
          sophiag Sophia Guo added a comment -

          happens in Jenkins is at 2.46.3

          Show
          sophiag Sophia Guo added a comment - happens in Jenkins is at 2.46.3
          Hide
          sawyer xu chan added a comment - - edited

          Thanks ! error gone . @Hari Dara 

          Show
          sawyer xu chan added a comment - - edited Thanks ! error gone . @ Hari Dara  

            People

            • Assignee:
              Unassigned
              Reporter:
              gregh3269 Greg Huber
            • Votes:
              20 Vote for this issue
              Watchers:
              30 Start watching this issue

              Dates

              • Created:
                Updated: