docent-net / docent-net/mc-server-manager

is 'systemctl stop' safe on a minecraft server?

Open
#45 6 comments 1 reaction 0 assignees View on GitHub
backend bug good first issue
Dominant language
Python
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

It looks like minecraft server does not clean up properly when it receives a signal from systemctl. When I use manage.py to stop the server the log shows that it terminates immediately without saving the current state.
```
(backend) (setup) [giles@gklinux backend]$ ./manage.py start
Server secondSpigot started succesfully!
(backend) (setup) [giles@gklinux backend]$ ./manage.py stop
Server secondSpigot stopped succesfully!
(backend) (setup) [giles@gklinux backend]$ tail ../../minecraft-server/logs/latest.log
[18:24:09] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[18:24:10] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[18:24:10] [Server-Worker-1/INFO]: Preparing spawn area: 89%
[18:24:10] [Server thread/INFO]: Time elapsed: 2219 ms
[18:24:10] [Server thread/INFO]: Preparing start region for dimension 'world_the_end'/minecraft:the_end
[18:24:11] [Server thread/INFO]: Preparing spawn area: 0%
[18:24:11] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[18:24:11] [Server thread/INFO]: Time elapsed: 744 ms
[18:24:11] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[18:24:11] [Server thread/INFO]: Done (15.658s)! For help, type "help"
(backend) (setup) [giles@gklinux backend]$
```

When I launch the server from the command line and then type stop it reports that it is cleaning up and saving chunks (the same output appears in latest.log).
```
[giles@gklinux minecraft-server]$ java -jar spigot-1.15.2.jar
Loading libraries, please wait...
[18:26:55] [Server thread/INFO]: Starting minecraft server version 1.15.2
[18:26:55] [Server thread/INFO]: Loading properties
...
[18:27:10] [Server-Worker-3/INFO]: Preparing spawn area: 85%
[18:27:11] [Server-Worker-2/INFO]: Preparing spawn area: 98%
[18:27:11] [Server thread/INFO]: Time elapsed: 2028 ms
[18:27:11] [Server thread/INFO]: Preparing start region for dimension 'world_the_end'/minecraft:the_end
[18:27:11] [Server thread/INFO]: Preparing spawn area: 0%
[18:27:11] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[18:27:12] [Server thread/INFO]: Time elapsed: 790 ms
[18:27:12] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[18:27:12] [Server thread/INFO]: Done (15.668s)! For help, type "help"
>stop
[18:27:21] [Server thread/INFO]: Stopping the server
[18:27:21] [Server thread/INFO]: Stopping server
[18:27:21] [Server thread/INFO]: Saving players
[18:27:21] [Server thread/INFO]: Saving worlds
[18:27:21] [Server thread/INFO]: Saving chunks for level 'world'/minecraft:overworld
[18:27:21] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[18:27:21] [Server thread/INFO]: Saving chunks for level 'world_nether'/minecraft:the_nether
[18:27:22] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[18:27:22] [Server thread/INFO]: Saving chunks for level 'world_the_end'/minecraft:the_end
[18:27:22] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[18:27:22] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[18:27:22] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[18:27:22] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
>[giles@gklinux minecraft-server]$
```

The risks are that the very latest changes to the world will not be saved, and worse that you catch it in the middle of an automatic save and corrupt some of the files.

The mitigation would be to send a stop command via RCON and wait for the server to close itself.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.