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

Fix: Server does not stop #2097

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devreluije
Copy link

@devreluije devreluije commented Apr 14, 2024

Problem: Server doesn't stop when using MinecraftServer#stopCleanly inside a command

Resolves #2096

Why this bug happens ?
During the server lifecycle commands are executed in connection().tick(msTime) (ServerProcessImpl.TickerImpl class)
image

When you use the /shutdown command, MinecraftServer#stopCleanly method is called which stops all TickThread
After all commands are executed, serverTick(msTime) is called which start (stopped TickThread) and wait until threads are finished

Solution: set a flag to true when stop method is called and check this flag at end of tick

@thebadlorax
Copy link

i concur, when i made my /stop command i had to just put a System.exit(0) at the end.

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.

Server doesn't stop correctly
2 participants