-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
Close threads at server shutdown #4029
Conversation
core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java
Outdated
Show resolved
Hide resolved
Can we make sure this works with |
Will that call GeyserServer.shutdown()? If so things will break for the cases where the EventLoopGroup is held in a static class variable and some other approach will be needed. |
Spigot's reload should also be tested (despite it being terrible) to make sure things don't get any worse than they already are |
Like I wrote in the MCProtocolLib PR, it is probably best for someone that knows Geyser to reimplement these changes properly. This patch was literally created with grep, jstack and jdb. |
I can confirm /geyser reload is completely broken, as expected. However, I wonder if the better solution would be to make the event loop groups instance variables instead of class members. I think we only create one instance of any of the classes holding event loop groups so there is no real point in making them static class variables. We never reuse them anyway. I need to go over all of them, but I think we never create many of them. At least not on a regular server. Are there cases with multiple instances in one process and where it is desireable to share worker pools? |
173f70f
to
afbd51b
Compare
I pushed an update that allows /geyser reload to work. I am not able to test spigot reload as I do not have such a system set up anymore. |
afbd51b
to
303d1cc
Compare
Rebased to latest master. |
303d1cc
to
809bf5d
Compare
Rebased to latest master |
809bf5d
to
fe71dfb
Compare
Switched to using the alterantive PR for ProtocolLib (GeyserMC/MCProtocolLib#748) after comments from Camotoy. This one no longer has an explicit shutdown of the TcpClientSession EventLoopGroup. That is now reaped on process exit. The remaining EventLoopGroup threads are still shutdown on Geyser shutdown. I have tested /geyser reload and that seems to work. |
fe71dfb
to
33a162e
Compare
Rebased to latest master. |
33a162e
to
955042a
Compare
Rebased |
955042a
to
3c89693
Compare
Rebased and tested |
thank you |
To exit normally all non-daemon threads of the java process are supposed to have stopped. There are several cases of EventLoopGroup-created thread pools that are not shut down as a part of the server shutdown. These threads are spawned on the first Bedrock player login. The identified cases are: - The listener threads in GeyserServerInitializer - The player threads in GeyserServerInitializer - The EXECUTOR_SERVICE in the SkinProvider This patch depends on the PR GeyserMC/MCProtocolLib#748 submitted to MCProtocolLib to allow the TcpCLientSession to shut down on process exit. This is a very quickly thrown together proof of concept to verify that the execution thread pools left running were what blocked a clean exit with Geyser active. Nullify EventLoopGroup variables after shutdown to allow them to be restarted.
3c89693
to
5386df3
Compare
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.
Tested on all platforms (compiled locally with the mcpl pr), works perfectly! Thanks for this fix & for keeping the PR updated :)
Until 1.20.2 when we can target a newer MCPL |
…op_threads_on_shutdown
thanks again! |
To exit normally all non-daemon threads of the java process are supposed to have stopped. There are several cases of EventLoopGroup-created thread pools that are not shut down as a part of the server shutdown.
These threads are spawned on the first Bedrock player login. The identified cases are:
This patch depends on the PR
GeyserMC/MCProtocolLib#744 submitted to MCProtocolLib.
This is a very quickly thrown together proof of concept to verify that the execution thread pools left running were what blocked a clean exit with Geyser active.