RFR: 8307536: FileAlreadyExistsException from NativeLibLoader when running concurrent applications with empty cache
Jose Pereda
jpereda at openjdk.org
Tue Aug 1 11:32:48 UTC 2023
On Tue, 1 Aug 2023 06:59:59 GMT, Johan Vos <jvos at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/glass/utils/NativeLibLoader.java line 311:
>>
>>> 309: FileLock fileLock = fileChannel.lock()) {
>>> 310: try {
>>> 311: if (!Files.exists(path)) {
>>
>> This code would fail if the target file exists but has a 0 length, or any length other that the actual resource length, or with the right length but wrong content.
>> Do we want to address these scenarios?
>
> This is a different type of a problem, that imho should be addressed as well, but in a separate issue which also contains a test strategy. This is something that requires a hash-based solution, but it is something that needs to be done with great care, so I personally wouldn't rush this into this PR (as it might cause criticial regression if not done correctly).
Agree to do it separately, but in any case, if there was already a file at the cache directory, its checksum is verified, and in case it is not the same, the file is removed from the cache, before it is copied again.
Does this cover the possible scenarios you are referring to?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1188#discussion_r1280492135
More information about the openjfx-dev
mailing list