RFR: 8323670: A few client tests intermittently throw ConcurrentModificationException [v2]

Alexey Ivanov aivanov at openjdk.org
Mon Jan 29 14:27:28 UTC 2024


On Thu, 25 Jan 2024 13:58:50 GMT, Tejesh R <tr at openjdk.org> wrote:

>> Suggested fix [JDK-8307091](https://bugs.openjdk.org/browse/JDK-8307091) also created concurrent exception intermittently (monthly once/quarterly once) on CI system. The issue was not able to be reproduced yet, hence proposing an alternative fix which uses iterators to compare the List.
>> CI testing shows green.
>
> Tejesh R has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Revert fix 8307091 + Synchronised filecache
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into branch_8323670
>  - Fix

> > > 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.
> 
> According to my analysis above, there there are two threads. (The third thread is also possible if `validateFileCache` is called not on EDT.) The only thread that modifies `fileCache` is EDT with `DoChangeContents`. Then the `ShellFolder` thread reads from `fileCache` _without synchronisation_, which allows the contents of `fileCache` to be modified concurrently.

Upon further testing, I found out that `ShellFolder.invoke` runs in the calling thread on Linux and macOS, on Windows it runs on the COM thread where Windows Shell is accessed.

In addition to this, there's [`AquaFileSystemModel`](https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java). This class is used in Aqua Look-and-Feel on macOS.

According to this comment

https://github.com/openjdk/jdk/blob/fe0eec7e20bc4c39d6c2b58d81ffd5c0ef1fdeda/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java#L41

the class contains portions of code copied from `BasicDirectoryModel` and therefore could have a similar synchronisation issue.

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

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


More information about the client-libs-dev mailing list