Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Fix dev-watch tests server shutdown #399

Open
wants to merge 4 commits into
base: 9.x
Choose a base branch
from

Conversation

jfdenise
Copy link
Collaborator

@jfdenise jfdenise commented Jun 21, 2024

It has been reported failing test execution on Windows of some DevWatch test. Although the test is passing, the test fails when shutting down the server.

I also updated the DevWatchTestCase to remove another instability.

I suspect the server process shutdown hook to not be run on Windows. We have 2 shutdown in //, with one of the two receiving an exception when sending :shutdown , this exception causes abrupt termination of the server process (On Windows it seems not yet fixed (very old but seems still the case: https://bugs.openjdk.org/browse/JDK-8056139) that in turn will not run its shutdown hooks: https://github.com/wildfly-extras/wildfly-jar-maven-plugin/blob/main/plugin/src/main/java/org/wildfly/plugins/bootablejar/maven/goals/DevWatchBootableJarMojo.java#L1301)

If the test was not calling a shutdown of the server in // with the DevWatchGoal shutdown, I suspect that we shouldn't observe the issue.

If a failure occurs, calling process.destroy is the right thing to do. We want the process to end, in Dev Mode having the installation directory to be deleted is needed but is not that strict. We should add a WARN trace. I logged:

#398

We have 4 processes:

In the Test process:

When the test is done.
First shutdown the server asynchronously (:shutdown)
Then write a file to have the mvn process to exit
Then wait 60 seconds for the mvn process to exit
If after 60secs it has not exited, fail the test ==> What we observe

In the mvn process:
The process has detected that it needs to exit (presence of the file)
It exists
Shutdown hook to shutdown the server is run

If an exception is thrown when calling server :shutdown (perhaps because of the shutdown, initiated by the test), process.destroy is called (https://github.com/wildfly-extras/wildfly-jar-maven-plugin/blob/main/plugin/src/main/java/org/wildfly/plugins/bootablejar/maven/goals/DevWatchBootableJarMojo.java#L1301)

On Windows process.destroy will make the process to exit without giving time to the shutdown hook to run.

Then it wait 60secs for the server to delete the installation (based on a marker file). ==> We observe that it waited and the server dir was not deleted

In the server process:
When shutdown is received, shutdown hook are run and cleanup of the server installation is fired in a new process (Only on windows due to file lock)

In the cleanup process:
Clean the file and exit
This one seems not started.

@jfdenise jfdenise force-pushed the investigate_devwatch_shutdown branch from 3806f89 to 22d9d25 Compare June 21, 2024 14:59
@jfdenise jfdenise force-pushed the investigate_devwatch_shutdown branch from 0ba335f to bf172b3 Compare June 21, 2024 16:04
@jfdenise jfdenise changed the title Investigate devwatch shutdown Investigate devwatch tests server shutdown Jun 21, 2024
@jfdenise jfdenise changed the title Investigate devwatch tests server shutdown Fix devwatch tests server shutdown Jun 21, 2024
@jfdenise jfdenise changed the title Fix devwatch tests server shutdown Fix dev-watch tests server shutdown Jun 21, 2024
@jfdenise jfdenise changed the title Fix dev-watch tests server shutdown [9.x] Fix dev-watch tests server shutdown Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant