Oddly this only happens once after the computer is restarted each time. Subsequently the loading would be much quicker.
Using the profiler the following stack trace is obtained:
main [RUNNABLE, IN_NATIVE] CPU time: 0:00
java.io.WinNTFileSystem.list(File)
java.io.File.list()
sun.security.provider.SeedGenerator$1.run()
java.security.AccessController.$$YJP$$doPrivileged(PrivilegedAction)
java.security.AccessController.doPrivileged(PrivilegedAction)
sun.security.provider.SeedGenerator.getSystemEntropy()
sun.security.provider.SecureRandom.engineNextBytes(byte[])
java.security.SecureRandom.nextBytes(byte[])
java.security.SecureRandom.next(int)
java.util.Random.nextLong()
java.io.File.generateFile(String, String, File)
java.io.File.createTempFile(String, String, File)
org.eclipse.core.runtime.adaptor.LocationManager.canWrite(File)
org.eclipse.core.runtime.adaptor.LocationManager.computeDefaultConfigurationLocation()
org.eclipse.core.runtime.adaptor.LocationManager.initializeLocations()
org.eclipse.core.runtime.adaptor.EclipseStarter.startup(String[], Runnable)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(String[], Runnable)
sun.reflect.NativeMethodAccessorImpl.invoke0(Method, Object, Object[])
sun.reflect.NativeMethodAccessorImpl.invoke(Object, Object[])
sun.reflect.DelegatingMethodAccessorImpl.invoke(Object, Object[])
java.lang.reflect.Method.invoke(Object, Object[])
org.eclipse.equinox.launcher.Main.invokeFramework(String[], URL[])
org.eclipse.equinox.launcher.Main.basicRun(String[])
org.eclipse.equinox.launcher.Main.run(String[])
org.eclipse.equinox.launcher.Main.main(String[])
The main thread is stuck in a native File.list() method. From the SeedGenerator source code, there is only one location where it calls the File.list() method, and it happens to match the stack trace — inside an anonymous inner class. From there we can see that it is trying to list the temp folder (system property java.io.tmpdir). On Windows, this is the “%USERPROFILE%\Local Settings\Temp” folder.
When I do a directory listing on the folder, I get more than 100,000 temp files. Removing them solves the problem.
From the stack trace Eclipse startup was trying to test whether a folder is writable, by creating a temporary file, which uses a random number generator to generate the filename, in turn using the list of filenames from the TEMP folder as part of the seed. Essentially this problem would surface if you have a TEMP folder with many many files (regardless of size) and perform any of the following:
- use File.list() on the folder (or any folder with many many files)
- generate a random number
- Create a temporary file
- Starting up Eclipse runtime…
Does Windows cache the directory listing so that it’s faster next time?