RFR: 8307536: FileAlreadyExistsException from NativeLibLoader when running concurrent applications with empty cache
Kevin Rushforth
kcr at openjdk.org
Sat Jul 29 14:46: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.
Since there is no robust solution that work in the presence of an older JavaFX writing to the cache concurrently, I'm not sure it would be worth the complexity to further narrow the window, but @jperedadnr can comment on that.
The proposed solution seems reasonable to me. I presume you've tested it?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1188#issuecomment-1656745632
More information about the openjfx-dev
mailing list