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

Sergey Bylokhov serb at openjdk.org
Tue Nov 29 23:55:26 UTC 2022


On Tue, 29 Nov 2022 21:36:31 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> 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.

Marked as reviewed by serb (Reviewer).

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

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



More information about the client-libs-dev mailing list