-
Bug
-
Resolution: Fixed
-
P3
-
10, 11, 17, 20
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8301533 | 20.0.2 | Robert Mckenna | P3 | Resolved | Fixed | b01 |
JDK-8301368 | 20.0.1 | Robert Mckenna | P3 | Resolved | Fixed | b04 |
JDK-8300723 | 17.0.7-oracle | Yoshiki Sato | P3 | Resolved | Fixed | b04 |
JDK-8301053 | 17.0.7 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
JDK-8300724 | 11.0.19-oracle | Yoshiki Sato | P3 | Resolved | Fixed | b04 |
JDK-8301172 | 11.0.19 | Victor Rudometov | P3 | Resolved | Fixed | b01 |
JDK-8301979 | 11.0.18.0.2-oracle | Dukebot | P3 | Closed | Fixed | b01 |
Windows
A DESCRIPTION OF THE PROBLEM :
listRoots used to return right away, (1 call takes <1ms), now (when the system has a CD/DVD drive), it takes 0.125 SECONDs to return. -When the system does not have a CD/DVD drive, it still take 25 ms to return.
This looks to be a regression from bug fix for 8182710: File.listRoots() always returns the root of CD drive.
Looks the fix after getting the listRoots0 further incurred some System calls, which added quite a bit of cost to the listRoots.
REGRESSION : Last worked in version 8u172
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the attached java source code with jdk 1.7 or 1.8, run it with command "java TestFileListRoots", it returns right away (0 ms). switch java to 9 (I used 9.0.4), do command "java TestFileListRoots", it still returns right away (0 ms). Now switch to use java 10 (I used 10.0.1), it took 0.125 seconds to return. Switch to java 11 (11-ea-15), similar bad performance.
ACTUAL -
C:\fzhou4_c2>java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
C:\fzhou4_c2>javac TestFileListRoots.java
C:\fzhou4_c2>java TestFileListRoots
Took 0.0 seconds
Here are the root paths:
C:\
D:\
E:\
S:\
Z:\
C:\fzhou4_c2>set JAVA_HOME=C:\fzhou4_c2\3rd_Party\jsdk\9.0.4\Windows
C:\fzhou4_c2>set PATH=C:\fzhou4_c2\3rd_Party\jsdk\9.0.4\Windows\bin
C:\fzhou4_c2>java TestFileListRoots
Took 0.0 seconds
Here are the root paths:
C:\
D:\
E:\
S:\
Z:\
C:\fzhou4_c2>set JAVA_HOME=C:\fzhou4_c2\3rd_Party\jsdk\10.0.1\Windows
C:\fzhou4_c2>set PATH=C:\fzhou4_c2\3rd_Party\jsdk\10.0.1\Windows\bin
C:\fzhou4_c2>java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
C:\fzhou4_c2>java TestFileListRoots
Took 0.125 seconds
Here are the root paths:
C:\
D:\
S:\
Z:\
C:\fzhou4_c2>set JAVA_HOME=C:\fzhou4_c2\3rd_Party\jsdk\11.ea.15\Windows
C:\fzhou4_c2>set PATH=C:\fzhou4_c2\3rd_Party\jsdk\11.ea.15\Windows\bin
C:\fzhou4_c2>java -version
java version "11-ea" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+15)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+15, mixed mode)
C:\fzhou4_c2>java TestFileListRoots
Took 0.125 seconds
Here are the root paths:
C:\
D:\
S:\
Z:\
---------- BEGIN SOURCE ----------
import java.io.File;
public class TestFileListRoots {
public static void main(String[] args) {
long start = System.currentTimeMillis();
int fileCount = 0;
File[] files = File.listRoots();
fileCount = files.length;
String[] rootPaths = new String[fileCount];
int index = 0;
for (File file : files) {
String rootPath = file.getAbsolutePath();
rootPaths[index++] = rootPath;
}
long end = System.currentTimeMillis();
System.out.println("Took " + ((end - start)/1000.0) + " seconds");
System.out.println("Here are the root paths:");
for (String path : rootPaths) {
System.out.println(path);
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
- backported by
-
JDK-8300723 File.listRoots performance degradation
- Resolved
-
JDK-8300724 File.listRoots performance degradation
- Resolved
-
JDK-8301053 File.listRoots performance degradation
- Resolved
-
JDK-8301172 File.listRoots performance degradation
- Resolved
-
JDK-8301368 File.listRoots performance degradation
- Resolved
-
JDK-8301533 File.listRoots performance degradation
- Resolved
-
JDK-8301979 File.listRoots performance degradation
- Closed
- relates to
-
JDK-8182710 File.listRoots() always returns the root of CD drive
- Closed
-
JDK-8306431 File.listRoots method description should be re-examined
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/e1ca75ab
-
Commit openjdk/jdk17u-dev/ba956c56
-
Commit openjdk/jdk20u/db9e39bf
-
Commit openjdk/jdk/5b0af1a8
-
Review openjdk/jdk11u-dev/1681
-
Review openjdk/jdk17u-dev/1098
-
Review openjdk/jdk20u/2
-
Review openjdk/jdk/12072