-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Stop FileWatcher default instance on dedicated server exit #1757
Stop FileWatcher default instance on dedicated server exit #1757
Conversation
This prevents the FileWatcher instance from blocking the JVM from exiting normally, as the instance keeps alive a non-daemon thread (and the JVM waits on all non-daemon threads to exit). Fixes neoforged#1626
Last commit published: c472ab2bc31359280b13fa2e30cfdecf93cdd685. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #1757' // https://github.com/neoforged/NeoForge/pull/1757
url 'https://prmaven.neoforged.net/NeoForge/pr1757'
content {
includeModule('net.neoforged', 'testframework')
includeModule('net.neoforged', 'neoforge')
}
}
} MDK installationIn order to setup a MDK using the latest PR version, run the following commands in a terminal. mkdir NeoForge-pr1757
cd NeoForge-pr1757
curl -L https://prmaven.neoforged.net/NeoForge/pr1757/net/neoforged/neoforge/21.4.15-beta-pr-1757-1.21.4-GH-1626-filewatcher-dediserver-shutdown/mdk-pr1757.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip To test a production environment, you can download the installer from here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fairly major bug, we should ideally backport the fix to 1.21.1 as well.
Will merge if no objections by tomorrow (like 8 hours from now lol) |
🚀 This PR has been released as NeoForge version |
This PR fixes #1626 by stopping the default
FileWatcher
instance when the dedicated server instance exits (fromDedicatedServer#onServerExit()
).This prevents the
FileWatcher
instance from blocking the JVM from exiting normally, as the instance keeps alive a non-daemon thread (and the JVM waits on all non-daemon threads to exit).This is meant to be a temporary bugfix, until a bugfix is landed in NightConfig that marks the pool thread it creates as a daemon thread. (Follow the linked issue for more details.)
Tested by following the listed reproduction steps in the issue (which is important, since the FileWatcher has to be triggered once for the erring pool thread to be made), and observing that the JVM does exit soon after the server is stopped through
/stop
.Out of the 'normal' runs, the dedicated server is affected. The client and the game test server exit the JVM using
System.exit
, as seen inMinecraft#destroy
andGameTestServer#onServerExit
respectively. The datagenerator, both client and server, does not load the configs, as seen inCommonModLoader#begin
.The JUnit server might be affected, but I am unsure if it is truly affected, since it may be that JUnit itself does a
System.exit
at the end of testing to handle the exit codes itself. I'm leaning towards the possibility that it is unaffected due to the special considerations of JUnit.