RFR: 8271519: java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java failed with "Total [200] - Expected [400]"

Alexander Zvegintsev azvegint at openjdk.org
Tue Nov 29 21:45:21 UTC 2022


This test was trying to add windows to `ArrayList` instance from two different threads without any synchronization. 

So the reported test failure happens when the `WINDOWS` list contains only one windows instead of expected two.

Another possible failure is:

Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 0
        at java.base/java.util.ArrayList.add(ArrayList.java:455)
        at java.base/java.util.ArrayList.add(ArrayList.java:467)
        at MultipleContextsFunctionalTest$1$1.run(MultipleContextsFunctionalTest.java:107)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Total [200] - Expected [400]
Test FAILED


The test fails in about 8 out of 100 runs in a cycle for me.

Changing `ArrayList` to `CopyOnWriteArrayList` solves the issue. Didn't fail once after modification and 300 runs.

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

Commit messages:
 - initial

Changes: https://git.openjdk.org/jdk/pull/11423/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11423&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8271519
  Stats: 5 lines in 1 file changed: 1 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/11423.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11423/head:pull/11423

PR: https://git.openjdk.org/jdk/pull/11423



More information about the client-libs-dev mailing list