RFR: 8207005 : Disable the file canonicalization cache by default

Brent Christian brent.christian at oracle.com
Tue Jul 10 21:02:38 UTC 2018


Hi,

Please review this change to disable the file canonicalization cache by 
default.

Bug:
https://bugs.openjdk.java.net/browse/JDK-8207005

 From the bug report:
"The file canonicalization cache was added back in JDK 1.4.2 in order to 
improve startup time.

The cache has long-standing correctness issues (JDK-7066948, for 
example). For this reason, it has been desired to disable the cache by 
default, but the increase to startup time was undesirable.

Recent JDK releases have removed usages of the cache, in particular from 
FilePermission (JDK-8164705 in JDK 9). This reduced usage of the 
canonicalization cache should also reduce the startup effect of 
disabling the cache by default. Measurements support this. Previous 
measurements showed the startup effect of disabling the cache on Linux 
to be 3-6%, depending on the specific benchmark. The same comparison 
performed last month now shows no startup change on Linux.

The file canonicalization cache can still be enabled by setting the 
"sun.io.useCanonCaches" system property. This is merely a change to the 
default value."

Here is the diff:

--- a/src/java.base/share/classes/java/io/FileSystem.java
@@ -231,8 +231,8 @@

      // Flags for enabling/disabling performance optimizations for file
      // name canonicalization
-    static boolean useCanonCaches      = true;
-    static boolean useCanonPrefixCache = true;
+    static boolean useCanonCaches      = false;
+    static boolean useCanonPrefixCache = false;

      private static boolean getBooleanProperty(String prop, boolean 
defaultVal) {
--

Thanks,
-Brent


More information about the core-libs-dev mailing list