On Fri, 26 Jan 2024 22:57:49 GMT, Sergey Bylokhov <[email protected]> wrote:

>>> What is the code path which modifies the vector when we iterate it?
>> 
>> I don't think we are able to trace it out, since the issue intermittent and 
>> previously I had made a copy of the vector list before checking for equality 
>> of the list. There was again an issue in the code which I used to copy to a 
>> temporary vector. So now instead of using` AbstractList.equals` I'm using 
>> iterators and comparing every element within synchronized method.
>
>> I don't think we are able to trace it out, since the issue intermittent and 
>> previously I had made a copy of the vector list before checking for equality 
>> of the list. There was again an issue in the code which I used to copy to a 
>> temporary vector. So now instead of using` AbstractList.equals` I'm using 
>> iterators and comparing every element within synchronized method.
> 
> I think we should start investigating this one, probably by adding special 
> delays/asserts into the JDK to track down on what threads the data is 
> modified and used.

@mrserb I've been trying to write a regression test for this problem. Have I 
succeeded? Not quite… I am unable to get `ConcurrentModificationException` on 
any platform when I run the test locally. However, the test fails in the Oracle 
CI on macOS and Linux, both x86_64 and aarch64, especially when run with 
`JTREG=REPEAT_COUNT=50`. On Windows, it fails with `OutOfMemoryError`.

In the CI on macOS, the test runs in headless mode, in this case 
`BasicDirectoryModel` is used instead of `AquaFileSystemModel`.

Thus, the test is not stable enough. Yet it still allows testing the fix. The 
test does not fail with `ConcurrentModificationException` when run on the build 
with the proposed fix in this PR.

Could you please run the test too?


git fetch https://github.com/aivanov-jdk/jdk.git 
8323670-BasicDirectoryModel-concurrency:8323670-BasicDirectoryModel-concurrency
git checkout 8323670-BasicDirectoryModel-concurrency
java 
test/jdk/javax/swing/JFileChooser/FileSystemView/BasicDirectoryModelConcurrency.java


The commands above are similar to those provided in “Reviewing using Git” 
section in PRs on GitHub.

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

PR Comment: https://git.openjdk.org/jdk/pull/17462#issuecomment-1914844026

Reply via email to