JDK-8157509 : UserDataDirectoryTest fails on Windows platforms with updated WebKit
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u112,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-21
  • Updated: 2016-06-15
  • Resolved: 2016-06-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u112Fixed 9Fixed
Related Reports
Relates :  
I see the following test failure on Windows with the updated webkit from JDK-8156698:

java.io.IOException: Error deleting [foo\localstorage\file__0.localstorage]
	at test.javafx.scene.web.UserDataDirectoryTest.deleteRecursively(UserDataDirectoryTest.java:572)
	at test.javafx.scene.web.UserDataDirectoryTest.deleteRecursively(UserDataDirectoryTest.java:568)
	at test.javafx.scene.web.UserDataDirectoryTest.deleteRecursively(UserDataDirectoryTest.java:568)
	at test.javafx.scene.web.UserDataDirectoryTest.afterClass(UserDataDirectoryTest.java:103)

The following log messages are written to stderr:

onError: WebErrorEvent [source = javafx.scene.web.WebEngine@d51fdb, eventType = USER_DATA_DIRECTORY_IO_ERROR, message = "An I/O error occurred while setting up user data directory [qux]", exception = java.nio.file.FileAlreadyExistsException: modules\web\qux]
onError: WebErrorEvent [source = javafx.scene.web.WebEngine@1e8fb8d, eventType = USER_DATA_DIRECTORY_ALREADY_IN_USE, message = "User data directory [baz] is already in use", exception = javafx.scene.web.DirectoryLock$DirectoryAlreadyInUseException: modules\web\baz]
onError: WebErrorEvent [source = javafx.scene.web.WebEngine@af62ee, eventType = USER_DATA_DIRECTORY_SECURITY_ERROR, message = "A security error occurred while setting up user data directory [foo]", exception = java.security.AccessControlException: access denied ("java.io.FilePermission" "modules\web\foo" "write")]

changeset: 9841:5da9d03eadce user: arajkumar date: Wed Jun 15 08:17:35 2016 +0100 description: 8157509: UserDataDirectoryTest fails on Windows platforms with updated WebKit Reviewed-by: kcr, ghb URL: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/5da9d03eadce




I tried changing the value of DefaultStorageDatabaseIdleInterval to 0 sec, but still I could reproduce the issue intermittently because of async nature. It is not a good idea to make the file system access as sync operation also. I tried with File.deleteOnExit(..), which seems to be deleting the file during vm shutdown, I'm not sure whether it is a right solution. diff -r 0644eb5da6b4 modules/web/src/test/java/test/javafx/scene/web/UserDataDirectoryTest.java --- a/modules/web/src/test/java/test/javafx/scene/web/UserDataDirectoryTest.java Tue May 10 14:33:55 2016 -0700 +++ b/modules/web/src/test/java/test/javafx/scene/web/UserDataDirectoryTest.java Wed May 25 20:01:59 2016 +0100 @@ -98,7 +98,6 @@ public static void afterClass() throws IOException { preLockedLock.release(); preLockedRaf.close(); - sleep(500); // Give WebKit some time to close SQLite files for (File dir : DIRS) { deleteRecursively(dir); } @@ -568,9 +567,7 @@ deleteRecursively(f); } } - if (!file.delete()) { - throw new IOException(String.format("Error deleting [%s]", file)); - } + file.deleteOnExit(); } private void assertLocked(File directory) {

StorageTracker.cpp // If there is no document referencing a storage database, close the underlying database // after it has been idle for m_StorageDatabaseIdleInterval seconds. static const double DefaultStorageDatabaseIdleInterval = 300;

Right Kevin, Now it takes more time(~5 mins) to close the sqlite file from WebCore,. Issue is not seen in *Nix platforms, because closing a file is equivalent to releasing a reference to it. Figuring out a way to sync and close db file when WebPage instance is deleted.

This is failing in the "@AfterClass public static void afterClass()" method of UserDataDirectoryTest. This suggests that when this cleanup method is called, WebKit is still holding onto the files. I note that the implementation of this cleanup seems fragile. There is a 500ms sleep with a comment that says "Give WebKit some time to close SQLite files". That is just asking for trouble.

I should note that this is intermittent. It failed for me twice yesterday, once on Win 7 and once on Win 10, but passed 2 or 3 times on each platform after that.