On Fri, 15 Mar 2024 14:50:12 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> Ensure access to the `filesLoader` field of `BasicDirectoryModel` is 
>> synchronized.
>> 
>> Without synchronization, a thread checks if `filesLoader` is not null and 
>> creates a new `FilesLoader` thread. If the thread is pre-empted between 
>> these two operations, another thread or even several threads can see the 
>> `null` value and create new `FilesLoader` threads.
>> 
>> The same way, `BasicDirectoryModel.invalidateFileCache` needs to be 
>> synchornized to interrupt the current `filesLoader` and assign `null`.
>> 
>> This bug allows reproducing `ConcurrentModificationException` seen in 
>> [JDK-8323670](https://bugs.openjdk.org/browse/JDK-8323670) and 
>> [JDK-8307091](https://bugs.openjdk.org/browse/JDK-8307091) using the test in 
>> PR #18109.
>
> Alexey Ivanov has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Increment fetch ID to invalidate pending DoChangeContents

Marked as reviewed by serb (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/18111#pullrequestreview-1944748397

Reply via email to