RFR: 8307536: FileAlreadyExistsException from NativeLibLoader when running concurrent applications with empty cache
Andy Goryachev
angorya at openjdk.org
Fri Jul 28 15:13:49 UTC 2023
On Fri, 28 Jul 2023 09:11:07 GMT, Jose Pereda <jpereda at openjdk.org> wrote:
> This PR adds a file lock to the cache directory, allowing access from multiple processes (that is, from more than one JVM) to that directory.
>
> This helps solving the issue where the cache is empty or doesn't exist yet, and two JavaFX applications start at the same time, and both try to copy the same native libraries to the same cache.
>
> No tests have been added to the PR though, since this requires a complex scenario: building the SDK and publishing to local Maven repository, creating two simple JavaFX applications that use those artifacts, using a temporary folder for cache (via `javafx.cachedir`, and launching in parallel both applications.
>
> I've tested successfully such scenario on Linux, Mac and Windows.
Would it still fail if an earlier JVM tries to write to the cache dir?
Just a wild idea: what if we double-check (the file hash?) after writing files or something like that? I know, that still won't help if an older JVM writes to the same dir...
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1188#issuecomment-1655863051
More information about the openjfx-dev
mailing list