java.nio.file.FileAlreadyExistsException: (path2onesJob)/lastSuccessful

Jenkins JIRA | Marco Miller | 3 years ago
  1. 0

    Some Jenkins instances of ours do log FileAlreadyExistsException-s from time to time: java.nio.file.FileAlreadyExistsException: (path2onesJob)/lastSuccessful at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88) (..) at hudson.Util.createSymlinkJava7(Util.java:1122) (..) -Above trace mapping to 1.509.2. Code shows "proper" deletion of symlink prior to (re)creating it: (..) filesC.getMethod("deleteIfExists", pathC).invoke(null, path); Object noAttrs = Array.newInstance(Class.forName("java.nio.file.attribute.FileAttribute"), 0); filesC.getMethod("createSymbolicLink", pathC, pathC, noAttrs.getClass()).invoke(null, path, target, noAttrs); -Looking at that code and around, I suspect some occasional race condition by lack of concurrency safeness: 1. thread-A deletes any existing lastSuccessful symlink (so far so good) 2. thread-B deletes it too but that is a no-op by now, given 1. 3. thread-A (re)creates the symlink (no problem yet) 4. thread-B recreates the symlink, but that throws our hereby exception, given 3. (problematic). -Unless such initial deletion fails because of this: "On some operating systems it may not be possible to remove a file when it is open and in use by this Java virtual machine or other programs." (*) (*) http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#deleteIfExists(java.nio.file.Path) -Assuming the above threading hypothesis and solving it to be hard & risky.

    Jenkins JIRA | 3 years ago | Marco Miller
    java.nio.file.FileAlreadyExistsException: (path2onesJob)/lastSuccessful
  2. 0

    Some Jenkins instances of ours do log FileAlreadyExistsException-s from time to time: java.nio.file.FileAlreadyExistsException: (path2onesJob)/lastSuccessful at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88) (..) at hudson.Util.createSymlinkJava7(Util.java:1122) (..) -Above trace mapping to 1.509.2. Code shows "proper" deletion of symlink prior to (re)creating it: (..) filesC.getMethod("deleteIfExists", pathC).invoke(null, path); Object noAttrs = Array.newInstance(Class.forName("java.nio.file.attribute.FileAttribute"), 0); filesC.getMethod("createSymbolicLink", pathC, pathC, noAttrs.getClass()).invoke(null, path, target, noAttrs); -Looking at that code and around, I suspect some occasional race condition by lack of concurrency safeness: 1. thread-A deletes any existing lastSuccessful symlink (so far so good) 2. thread-B deletes it too but that is a no-op by now, given 1. 3. thread-A (re)creates the symlink (no problem yet) 4. thread-B recreates the symlink, but that throws our hereby exception, given 3. (problematic). -Unless such initial deletion fails because of this: "On some operating systems it may not be possible to remove a file when it is open and in use by this Java virtual machine or other programs." (*) (*) http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#deleteIfExists(java.nio.file.Path) -Assuming the above threading hypothesis and solving it to be hard & risky.

    Jenkins JIRA | 3 years ago | Marco Miller
    java.nio.file.FileAlreadyExistsException: (path2onesJob)/lastSuccessful
  3. 0

    [JIRA] [build-publisher-plugin] (JENKINS-22516) FileAlreadyExistsException on parallel builds

    Google Groups | 1 year ago | elg...@gmail.com (JIRA)
    java.nio.file.FileAlreadyExistsException: C:\.jenkins\jobs\XXXXX\lastSuccessful
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [JIRA] [core] (JENKINS-25930) Race condition creating build links during concurrent builds causes build failures

    Google Groups | 2 years ago | angelo...@iress.com.au (JIRA)
    java.nio.file.FileAlreadyExistsException: C:\Users\Administrator\.jenkins\jobs\TraderPlus.UI.Test\lastSuccessful
  6. 0

    GitHub comment 6529#172553291

    GitHub | 11 months ago | deads2k
    java.nio.file.FileAlreadyExistsException: /var/lib/jenkins/jobs/test_pull_requests_origin/lastSuccessful

    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.FileAlreadyExistsException

      (path2onesJob)/lastSuccessful

      at sun.nio.fs.UnixException.translateToIOException()
    2. Java RT
      UnixException.translateToIOException
      1. sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
      1 frame