On 19/12/17 5:13 PM, Jaikiran Pai wrote:

Looking at the JDK code, I still am not sure which exact code path triggers this stale/invalid cache in this specific case, but apparently it does.

Now that we know the canonical path cache is playing a role, I think the only way this issue makes sense is the following flow:

1. Some code somewhere invokes getCanonicalPath on the *non-existent* "link1" file (and other similar symlink files). 2. Given that the file "link1" is non-existent, the JDK implementation gets back a path which points back to "link1" itself (getCanonicalPath is allowed on non-existent files) and then caches this result in its cache. 3. A symlink then gets created with link1 pointing to a file1. At this point "link1" file does exist. The cache however isn't updated. 4. A call to getCanonicalPath on the now existent "link1" file happens. Given that a previous invocation has cached (an invalid) value, the invalid value pointing back to "link1" is returned back.

That's a guess. What's interesting is #1 and what/who triggers that call (maybe explicit or somewhere implicit).

But either way, at this point, I'm happy that we know what's going on and this ended up being a JVM issue (and a known/acknowledged one).

Thanks Stefan for narrowing this down.

-Jaikiran


  [exec]     [junit] Testsuite: 
org.apache.tools.ant.taskdefs.optional.unix.SymlinkTest
      [exec]     [junit] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time 
elapsed: 0.276 sec

-Jaikiran

On 19/12/17 5:02 PM, [email protected]:
Repository: ant
Updated Branches:
   refs/heads/master c2c821a38 -> 3dad11d41


disable a bunch of caches, just so we've tried that as well


Project:http://git-wip-us.apache.org/repos/asf/ant/repo
Commit:http://git-wip-us.apache.org/repos/asf/ant/commit/3dad11d4
Tree:http://git-wip-us.apache.org/repos/asf/ant/tree/3dad11d4
Diff:http://git-wip-us.apache.org/repos/asf/ant/diff/3dad11d4

Branch: refs/heads/master
Commit: 3dad11d4191074a95b0d83397e73a99bd5b3f0c1
Parents: c2c821a
Author: Stefan Bodewig<[email protected]>
Authored: Tue Dec 19 12:31:26 2017 +0100
Committer: Stefan Bodewig<[email protected]>
Committed: Tue Dec 19 12:31:26 2017 +0100

----------------------------------------------------------------------
  build.xml | 2 ++
  1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/3dad11d4/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 36df7a4..0939eb5 100644
--- a/build.xml
+++ b/build.xml
@@ -1665,6 +1665,8 @@ ${antunit.reports}
            <sysproperty key="tests.and.ant.share.classloader"
                         value="${tests.and.ant.share.classloader}"/>
            <sysproperty key="java.io.tmpdir" file="${build.junit.tmpdir}"/>
+          <sysproperty key="sun.io.useCanonCaches" value="false"/>
+          <sysproperty key="sun.io.useCanonPrefixCache" value="false"/>
            <classpath>
              <path refid="tests-runtime-classpath"/>
              <pathelement location="${junit.collector.dir}"/>



Reply via email to