Skip to content

Conversation

@manukumarvs
Copy link
Member

@manukumarvs manukumarvs commented Sep 30, 2021

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8274597: [TESTBUG] Two of the dnd tests times out and fails

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5777/head:pull/5777
$ git checkout pull/5777

Update a local copy of the PR:
$ git checkout pull/5777
$ git pull https://git.openjdk.java.net/jdk pull/5777/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5777

View PR using the GUI difftool:
$ git pr show -t 5777

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5777.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 30, 2021

👋 Welcome back mvs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 30, 2021
@openjdk
Copy link

openjdk bot commented Sep 30, 2021

@manukumarvs The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Sep 30, 2021
@mlbridge
Copy link

mlbridge bot commented Sep 30, 2021

Webrevs

@mrserb
Copy link
Member

mrserb commented Sep 30, 2021

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(java.base@11.0.14-ea/Native Method)
- waiting on <0x00000000ff504d78> (a java.lang.Thread)
at java.lang.Thread.join(java.base@11.0.14-ea/Thread.java:1305)
- waiting to re-lock in wait() <0x00000000ff504d78> (a java.lang.Thread)
at java.lang.Thread.join(java.base@11.0.14-ea/Thread.java:1379)
at java.lang.ApplicationShutdownHooks.runHooks(java.base@11.0.14-ea/ApplicationShutdownHooks.java:107)
at java.lang.ApplicationShutdownHooks$1.run(java.base@11.0.14-ea/ApplicationShutdownHooks.java:46)

@manukumarvs
Copy link
Member Author

manukumarvs commented Oct 1, 2021

@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(java.base@11.0.14-ea/Native Method)
- waiting on <0x00000000ff504d78> (a java.lang.Thread)
at java.lang.Thread.join(java.base@11.0.14-ea/Thread.java:1305)
- waiting to re-lock in wait() <0x00000000ff504d78> (a java.lang.Thread)
at java.lang.Thread.join(java.base@11.0.14-ea/Thread.java:1379)
at java.lang.ApplicationShutdownHooks.runHooks(java.base@11.0.14-ea/ApplicationShutdownHooks.java:107)
at java.lang.ApplicationShutdownHooks$1.run(java.base@11.0.14-ea/ApplicationShutdownHooks.java:46)
at java.lang.Shutdown.runHooks(java.base@11.0.14-ea/Shutdown.java:130)
at java.lang.Shutdown.exit(java.base@11.0.14-ea/Shutdown.java:174)
- locked <0x00000000ff50a4e0> (a java.lang.Class for java.lang.Shutdown)
at java.lang.Runtime.exit(java.base@11.0.14-ea/Runtime.java:113)
at java.lang.System.exit(java.base@11.0.14-ea/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(java.base@11.0.14-ea/Native Method)
- waiting on <0x00000000ff69b6c0> (a java.lang.Object)
at java.lang.Object.wait(java.base@11.0.14-ea/Object.java:328)
at sun.awt.AWTAutoShutdown.run(java.desktop@11.0.14-ea/AWTAutoShutdown.java:291)
- waiting to re-lock in wait() <0x00000000ff69b6c0> (a java.lang.Object)
at java.lang.Thread.run(java.base@11.0.14-ea/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(java.base@11.0.14-ea/Native Method)
- parking to wait for <0x00000000ff6eda50> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(java.base@11.0.14-ea/LockSupport.java:194)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@11.0.14-ea/AbstractQueuedSynchronizer.java:2081)
at java.awt.EventQueue.getNextEvent(java.desktop@11.0.14-ea/EventQueue.java:566)
at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@11.0.14-ea/EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@11.0.14-ea/EventDispatchThread.java:124)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@11.0.14-ea/EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@11.0.14-ea/EventDispatchThread.java:109)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@11.0.14-ea/EventDispatchThread.java:101)
at java.awt.EventDispatchThread.run(java.desktop@11.0.14-ea/EventDispatchThread.java:90)

@mrserb
Copy link
Member

mrserb commented Oct 1, 2021

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

@manukumarvs
Copy link
Member Author

manukumarvs commented Oct 4, 2021

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?. 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.
I could also see a similar bug JDK-8197825 which was fixed by @prsadhuk, and there it was mentioned like the hang could have occurred in the ToolkitShutdown thread -> https://bugs.openjdk.java.net/browse/JDK-8197825?focusedCommentId=14156725&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14156725. Also, the fix for JDK-8197825 was done in the test code only and there is an open bug existing for the infinite loop issue -> JDK-8261016. 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?.

@mrserb
Copy link
Member

mrserb commented Oct 4, 2021

@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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 1, 2021

@manukumarvs This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 29, 2021

@manukumarvs This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Nov 29, 2021
@manukumarvs manukumarvs deleted the 8274597 branch April 20, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants