On Thu, 28 Jan 2021 05:53:05 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> My point is that this is not a test bug, so the test should not be changed. > > Please take a look at the "AwtToolkit::Dispose()" method, on how much stuff > should be done to properly shutdown the toolkit. This Dispose() method is > executed immediately when we exit the message loop in the > "Java_sun_awt_windows_WToolkit_eventLoop". So when the shutdown hook is > executed we should have the message loop, then we call tk.QuitMessageLoop to > stop it, and wait until all code in the Dispose() is executed. But since the > IsDisposed() return false we for unknow reason hang, does it mean that the > message loop still operates? Or we got some error during "QuitMessageLoop"? It seems in successful run, when the test finish - AwtToolkit::MessageLoop starts - DoQuitMessageLoop is called - AwtToolkit::QuitMessageLoop starts - AwtToolkit::QuitMessageLoop finishes - AwtToolkit::MessageLoop finish - Dispose() is called, m_isDisposed sets to true - shutdown hook isDisposed is true so no infinite loop During unsuccessful run, - AwtToolkit::MessageLoop starts - DoQuitMessageLoop is called - AwtToolkit::QuitMessageLoop starts - AwtToolkit::QuitMessageLoop finishes - AwtToolkit::MessageLoop NEVER ends so Dispose() is not called so m_isDisposed is not set to true so shutdown hook goes in infinite loop. ------------- PR: https://git.openjdk.java.net/jdk/pull/2220