On Tue, 29 Nov 2022 21:36:31 GMT, Alexander Zvegintsev <azveg...@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. This pull request has now been integrated. Changeset: 9f94cbec Author: Alexander Zvegintsev <azveg...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/9f94cbec51df7556d34fffa810e59dd9eb8521df Stats: 5 lines in 1 file changed: 1 ins; 1 del; 3 mod 8271519: java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java failed with "Total [200] - Expected [400]" Reviewed-by: serb ------------- PR: https://git.openjdk.org/jdk/pull/11423