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

Too many levels of symbolic links/Archiving artifact stuck

    Details

    • Similar Issues:

      Description

      When we have the symbolic links in src code like,

      dir1 -> .
      dir2 -> ../../../..

      Symptoms observed during this problematic phase:

      • The “Archiving artifact” step under Post- build phase get stuck. We can see the never ending cycling icon…
      • the slave node will report error like “too many levels of symbolic links” and ping response time would gradually degrade, eventually killing the slave.
      • the build log may also have error like WARN: Caught error while checking for symbolic links

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            "too many levels of symbolic links" comes from the operating system, it has nothing to do with Jenkins. From what I see dir2 points to the directory, which contains dir2. In such case it will cause the infinite recursion cycle in the operating system.

            Show
            oleg_nenashev Oleg Nenashev added a comment - "too many levels of symbolic links" comes from the operating system, it has nothing to do with Jenkins. From what I see dir2 points to the directory, which contains dir2. In such case it will cause the infinite recursion cycle in the operating system.
            Hide
            danielbeck Daniel Beck added a comment -

            Weirdly enough the archiving code is supposed to detect cycles and abort. I think there are other issues related to this.

            Show
            danielbeck Daniel Beck added a comment - Weirdly enough the archiving code is supposed to detect cycles and abort. I think there are other issues related to this.
            Hide
            lmcazra Audrey Azra added a comment -

            https://github.com/jenkinsci/jenkins/blob/08def67a18eee51de9f3f99bc2a792fee1c160e0/core/src/main/java/hudson/tasks/ArtifactArchiver.java#L251
            perhaps tuning system property value hudson.FilePath.VALIDATE_ANT_FILE_MASK_BOUND?
            Any recommendations or other suggestions Daniel?

            Show
            lmcazra Audrey Azra added a comment - https://github.com/jenkinsci/jenkins/blob/08def67a18eee51de9f3f99bc2a792fee1c160e0/core/src/main/java/hudson/tasks/ArtifactArchiver.java#L251 perhaps tuning system property value hudson.FilePath.VALIDATE_ANT_FILE_MASK_BOUND? Any recommendations or other suggestions Daniel?
            Hide
            danielbeck Daniel Beck added a comment -

            In JENKINS-36559 I got the impression that that option didn't work, but it's been a while since I've looked.

            No suggestions right no other than ensuring you don't have loops.

            Show
            danielbeck Daniel Beck added a comment - In JENKINS-36559 I got the impression that that option didn't work, but it's been a while since I've looked. No suggestions right no other than ensuring you don't have loops.
            Hide
            solarus David Spångberg added a comment - - edited

            The "to many levels of symbolic links" comes from "org.apache.tools.ant.DirectoryScanner.scandir" it seems.

            I tried the config.xml example from JENKINS-36559 and modified `hudson.Util.createFileSet(File, String, String)' to not follow symlinks, i.e. with `fs.setFollowSymlinks(false)'. Without the change I get slow archiving and the "too many levels of symbolic links" error log messages above. With the change the mentioned example seems to run ok. I'm testing on 1.642.4 instead of 1.642.3 though but I suppose that does not really matter.

            Show
            solarus David Spångberg added a comment - - edited The "to many levels of symbolic links" comes from "org.apache.tools.ant.DirectoryScanner.scandir" it seems. I tried the config.xml example from JENKINS-36559 and modified `hudson.Util.createFileSet(File, String, String)' to not follow symlinks, i.e. with `fs.setFollowSymlinks(false)'. Without the change I get slow archiving and the "too many levels of symbolic links" error log messages above. With the change the mentioned example seems to run ok. I'm testing on 1.642.4 instead of 1.642.3 though but I suppose that does not really matter.
            Hide
            krlf Kirill Fedoseev added a comment -

            Have the same issue. It breaks our slaves.

            Show
            krlf Kirill Fedoseev added a comment - Have the same issue. It breaks our slaves.
            Hide
            evildeece Alastair D'Silva added a comment -

            I worked around the issue by not using '**' to glob directories that contained symlinks to itself, but instead specified the exact files I required.

            Show
            evildeece Alastair D'Silva added a comment - I worked around the issue by not using '**' to glob directories that contained symlinks to itself, but instead specified the exact files I required.
            Hide
            vasba Vasile Baluta added a comment -

            Hi!

            Some updates related to versions from 2.89.2 and above.

            If anyone needs to do a patch then the solution proposed by David Spånberg is partly complete.

            setFolowSymlinks(false) needs also to be called for the instance of "org.apache.tools.ant.DirectoryScanner" created in method hasMatch in class hudson.FilePath.

            Show
            vasba Vasile Baluta added a comment - Hi! Some updates related to versions from 2.89.2 and above. If anyone needs to do a patch then the solution proposed by David Spånberg is partly complete. setFolowSymlinks(false) needs also to be called for the instance of "org.apache.tools.ant.DirectoryScanner" created in method hasMatch in class hudson.FilePath.

              People

              • Assignee:
                Unassigned
                Reporter:
                lmcazra Audrey Azra
              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: