shutdown after test

Kevin Rushforth kevin.rushforth at oracle.com
Wed Apr 24 13:13:46 UTC 2024


> There are a number of ways to solve this, e.g.
> * get rid of the separate shutdown procedure in the system tests.

The utility was added to have a consistent way to shut down the 
platform, so it would seem  a shame to remove it.

> * set Platform.setImplicitExit(false) which will prevent tkExit being 
> called when the last window is gone

I doubt we want to run most systems tests with setImplicitExit(false).

> * add more safety in test.util.Shutdown so that it doesn't try to use 
> the FX App thread when that is not accepting new runnables
> * ...

This seems best, if not too hard to implement. My quick thought on this 
is to add a package scope method to PlatformImpl (with a corresponding 
method in PlatformImplShim) to return the toolkitExit flag, which 
indicates whether or not the toolkit is running.

A fourth option might be to change the runAndWait to runLater, thus 
making it asynchronous. We would need to test whether this causes any 
stability problems on shutdown.

-- Kevin


On 4/24/2024 4:42 AM, Johan Vos wrote:
> While working on the systemtests for the Headless platform, I noticed 
> timing issues with the Marlin QPath Test. Those have nothing to do 
> with Marlin, but rather with the lifecycle. After the test ran, 
> `test.util.Shutdown` is invoked (not on the JavaFX app thread). I 
> noticed that this caused a timeout almost always when running the 
> systemtest with the headless platform, and almost never when running 
> with the regular (Gtk) platform.
> The problem is that the `test.util.Shutdown` method is invoking 
> Platform.runLater() but in some cases (almost always in Headless and 
> almost never in GTK) the runLater is not accepting runnables anymore. 
> This happens because of the PlatformImpl.checkIdle which will shutdown 
> the platform in case there are no windows and no pending runnables 
> (and a few more conditions). This check runs on the JavaFX app thread, 
> and it might trigger `tkExit` before the test-thread invokes 
> `test.util.Shutdown`.
>
> There are a number of ways to solve this, e.g.
> * get rid of the separate shutdown procedure in the system tests.
> * set Platform.setImplicitExit(false) which will prevent tkExit being 
> called when the last window is gone
> * add more safety in test.util.Shutdown so that it doesn't try to use 
> the FX App thread when that is not accepting new runnables
> * ...
>
> Thoughts?
>
> - Johan



More information about the openjfx-dev mailing list