DarkflameServer icon indicating copy to clipboard operation
DarkflameServer copied to clipboard

BUG: Server Docker container keeps running after server exited

Open Marcono1234 opened this issue 3 years ago • 2 comments

Make sure you've done the following:

  • [X] I have checked that this issue has not already been reported.

  • [X] I have validated that this issue is not a syntax error of either MySQL or SQLite.

  • [X] I have pulled the latest version of the main branch of DarkflameServer and have confirmed that the issue exists there.

Issue Description

When the server exits inside the Docker container (e.g. because it is shut down, due to setup failure or crash), the container keeps running indefinitely, due to this: https://github.com/DarkflameUniverse/DarkflameServer/blob/f6558aa31ecf873bacbc9b4d4366a89b5f24b4e2/docker/start_server.sh#L49

This is rather confusing because it is not obvious that the server has exited, see also related #417. Side note: Currently the server might also erroneously exit with code 0 when the initial database connection fails; this will be fixed in #416, see changed line.

I assume the reason why tail -f /dev/null was added is to inspect the container content after the server crashed. However, it appears there are alternatives such as running the container again with a different entrypoint.

Reproduction steps

Use the Docker Compose setup and make the server startup fail, e.g. by modifying docker-compose.yml to use different credentials for the database by changing changing the user name line to MARIADB_USER=someone.

Expected Behavior

The Docker server container should exit when the server exited; ideally also preserving the exit code.

Environment

WSL 2; Docker

Marcono1234 avatar Jan 25 '22 01:01 Marcono1234

I think we should keep tail -f /dev/null, but add a warning if the MasterServer exits with a non zero error code. We could also add a health check. I think it is a bit more convenient to explorer the container with tail -f /dev/null after it crashed.

TheNoim avatar Jan 25 '22 16:01 TheNoim

Might be relevant: https://stackoverflow.com/a/68773800/4087068

Xiphoseer avatar Feb 05 '22 17:02 Xiphoseer