On Fri, 1 Oct 2021 19:19:47 GMT, Sergey Bylokhov <[email protected]> wrote:
>> @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) > >> 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. > > This issue is unrelated to the non-daemon threads since the System.exit() is > called, it should exit the whole JVM. But before exit it executes some number > of registered ShutdownHook, we need to check what ShutdownHook is executed > and why it hangs. The AWT-Shutdown is not a hook, it is a thread which > prevents vm exit if there are some UI peers, but it does ont prevent the > System.exit(). > @mrserb I can see only two shutdown hooks registered, > Thread[ToolkitShutdown,6,system] and Thread[ScreenUpdater,6,system]. But I > don't know which one of this is getting hanged, any idea how can I check it? You can add logging to each of them and check, or you can debug the native code. >Also if we put a Thread.sleep(100) or just a System.out.println() at the end >of the main(), its not hanging and the tests are passing. maybe the test found a deadlock in the product and you just workaround it? >So for the time being in order to stabilise the test run on mach5 systems and >also considering the fact that this issue is currently reproducible only with >Windows 11 systems, can I go ahead and fix the tests?. The algorithm to use in such cases is something like this: - If the bug is in the test, then fix the test - If the bug is in the product then fix the product - If the root cause is unknown then add test to the problem list - Continue to work on the bug - Find the root cause - Fix the test/product and remove the test from the problem list ------------- PR: https://git.openjdk.java.net/jdk/pull/5777
