On Thu, 30 Sep 2021 20:17:57 GMT, Sergey Bylokhov <[email protected]> wrote:
>> These two dnd tests fails most of the time with a time out, mostly noticed >> in windows 11 machines. >> 1. java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java >> 2. java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java >> >> Fix: >> From the logs, I have noticed that some of the non-daemon threads are still >> waiting even after the test execution is complete. So it could be possible >> that java is waiting for these threads to be finished execution before the >> main thread exits. >> As a fix for this, I have put a Thread.sleep(100) at the end of the main() >> in order to enable other non-daemon threads get a chance to finish their >> execution before the main thread completes. > > Looks like the hang occurs in some of the hook executed at the "exit" step. > DId you check which ShutdownHook is executed and hang? Is it possible it is > some of the AWT toolkit related? > > at java.lang.Object.wait([email protected]/Native Method) > - waiting on <0x00000000ff504d78> (a java.lang.Thread) > at java.lang.Thread.join([email protected]/Thread.java:1305) > - waiting to re-lock in wait() <0x00000000ff504d78> (a java.lang.Thread) > at java.lang.Thread.join([email protected]/Thread.java:1379) > at > java.lang.ApplicationShutdownHooks.runHooks([email protected]/ApplicationShutdownHooks.java:107) > at > java.lang.ApplicationShutdownHooks$1.run([email protected]/ApplicationShutdownHooks.java:46) @mrserb I can see three non-daemon threads in 'WAITING' state(given below). So looks like 'AWT-Shutdown' thread created by AWTAutoShutdown.java is the hook which is getting blocked. But I think this is an expected behaviour only as it will block this thread until all AWT tasks are complete. "main" #1 prio=5 os_prio=0 cpu=78.13ms elapsed=240.13s tid=0x0000017129532000 nid=0x1518 in Object.wait() [0x0000001fb8ffe000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait([email protected]/Native Method) - waiting on <0x00000000ff504d78> (a java.lang.Thread) at java.lang.Thread.join([email protected]/Thread.java:1305) - waiting to re-lock in wait() <0x00000000ff504d78> (a java.lang.Thread) at java.lang.Thread.join([email protected]/Thread.java:1379) at java.lang.ApplicationShutdownHooks.runHooks([email protected]/ApplicationShutdownHooks.java:107) at java.lang.ApplicationShutdownHooks$1.run([email protected]/ApplicationShutdownHooks.java:46) at java.lang.Shutdown.runHooks([email protected]/Shutdown.java:130) at java.lang.Shutdown.exit([email protected]/Shutdown.java:174) - locked <0x00000000ff50a4e0> (a java.lang.Class for java.lang.Shutdown) at java.lang.Runtime.exit([email protected]/Runtime.java:113) at java.lang.System.exit([email protected]/System.java:1750) at com.sun.javatest.regtest.agent.AStatus.exit(AStatus.java:199) at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:84) "AWT-Shutdown" #24 prio=5 os_prio=0 cpu=0.00ms elapsed=239.97s tid=0x000001714cd43800 nid=0x29c4 in Object.wait() [0x0000001fba6fe000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait([email protected]/Native Method) - waiting on <0x00000000ff69b6c0> (a java.lang.Object) at java.lang.Object.wait([email protected]/Object.java:328) at sun.awt.AWTAutoShutdown.run([email protected]/AWTAutoShutdown.java:291) - waiting to re-lock in wait() <0x00000000ff69b6c0> (a java.lang.Object) at java.lang.Thread.run([email protected]/Thread.java:834) "AWT-EventQueue-0" #27 prio=6 os_prio=0 cpu=109.38ms elapsed=239.96s tid=0x000001714d006800 nid=0x1f70 waiting on condition [0x0000001fba8fe000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park([email protected]/Native Method) - parking to wait for <0x00000000ff6eda50> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:2081) at java.awt.EventQueue.getNextEvent([email protected]/EventQueue.java:566) at java.awt.EventDispatchThread.pumpOneEventForFilters([email protected]/EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEventsForFilter([email protected]/EventDispatchThread.java:124) at java.awt.EventDispatchThread.pumpEventsForHierarchy([email protected]/EventDispatchThread.java:113) at java.awt.EventDispatchThread.pumpEvents([email protected]/EventDispatchThread.java:109) at java.awt.EventDispatchThread.pumpEvents([email protected]/EventDispatchThread.java:101) at java.awt.EventDispatchThread.run([email protected]/EventDispatchThread.java:90) ------------- PR: https://git.openjdk.java.net/jdk/pull/5777
