JDK-8323670 : A few client tests intermittently throw ConcurrentModificationException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,11,17,21,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: aarch64
  • Submitted: 2024-01-12
  • Updated: 2024-05-07
  • Resolved: 2024-02-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 21 JDK 22 JDK 23
17.0.13-oracleFixed 21.0.5-oracleFixed 22.0.2Fixed 23 b09Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Few of test using directory models threw ConcurrentModificationException Intermittently on Oracle Linux OCI.:


WARNING: System::setSecurityManager will be removed in a future release
java.util.ConcurrentModificationException
	at java.base/java.util.AbstractList$SubList.checkForComodification(AbstractList.java:906)
	at java.base/java.util.AbstractList$SubList.size(AbstractList.java:792)
	at java.base/java.util.AbstractCollection.toArray(AbstractCollection.java:143)
	at java.base/java.util.Collections$SynchronizedCollection.toArray(Collections.java:2311)
	at java.base/java.util.Vector.<init>(Vector.java:182)
	at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader$1.call(BasicDirectoryModel.java:365)
	at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader$1.call(BasicDirectoryModel.java:342)
	at java.desktop/sun.awt.shell.ShellFolderManager$DirectInvoker.invoke(ShellFolderManager.java:148)
	at java.desktop/sun.awt.shell.ShellFolder.invoke(ShellFolder.java:532)
	at java.desktop/sun.awt.shell.ShellFolder.invoke(ShellFolder.java:518)
	at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader.run0(BasicDirectoryModel.java:342)
	at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader.run(BasicDirectoryModel.java:295)
	at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Test threw exception: java.util.ConcurrentModificationException
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.util.ConcurrentModificationException

Comments
A regression test for this changeset is provided by JDK-8327137. If you backport this changeset, consider backporting JDK-8327137 too.
17-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk22u/pull/149 Date: 2024-04-17 10:54:06 +0000
17-04-2024

Fix request: 22u This bug fix resolves a long-standing problem where using BasicDirectoryModel could throw ConcurrentModificationException. Clean backport. Medium risk. Pull request: https://github.com/openjdk/jdk22u/pull/149
17-04-2024

Changeset: 70e7cdcb Author: Tejesh R <tr@openjdk.org> Date: 2024-02-01 14:05:06 +0000 URL: https://git.openjdk.org/jdk/commit/70e7cdcb9ecedd455cf701b5c7ad05286ac0067d
01-02-2024

The problem can be reproduced with https://github.com/aivanov-jdk/jdk/blob/7cdf8c3610898557e91190d2bae440829a663376/test/jdk/javax/swing/JFileChooser/FileSystemView/BasicDirectoryModelConcurrency.java in 17u and 21u; I'm sure 11u and 8u are affected as well. JDK-8307091 hasn't been backported to any previous release.
30-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17462 Date: 2024-01-17 12:55:52 +0000
17-01-2024

Yes, though the frequency of its occurrences has been reduced, yet not able to completely resolve this. I think instead of using Vector.equals() for comparison, comparing iterators of the list would be a better choice in avoiding concurrent modification issue.
16-01-2024

Looks like the exception is happening inside the code that was introduced with the fix for JDK-8307091 where we are grabbing a sublist f file cache to create a new vector. The exception is being thrown from inside the constructor when it tries to convert a provided argument into array.
15-01-2024

A previous fix also addressed this failure mode: JDK-8307091 A few client tests intermittently throw ConcurrentModificationException
12-01-2024