itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.47k stars 1.55k forks source link

Verify server jar integrity #2092

Open denizkoekden opened 1 year ago

denizkoekden commented 1 year ago

Describe the problem

Hello, I use this Docker image inside of my own mc hosting system. Sometimes when I create a new Minecraft Server, i get an corrupt jarfile Error.

"[0mError: Invalid or corrupt jarfile minecraft_server.1.19.4.jar"

Error. So I have to delete the jar-file and restart the container, which is annoying. As I built it that whay to be an autonomus system. And now I always have to look after the jar files. :/

Maybe it is possible to hash check the files? This sometimes also happens to mods in curse forge mode.

Do you really need logs and docker-compose files? The things that set them appart from the default are actually private things. The logs look normal except the Invalid or corrupt jarfile error.

Regards

Container definition

Paste run command or compose file here

Container logs

Paste logs here
itzg commented 1 year ago

I'm sorry that happens on your system and I agree that negate the ability to automate. I have not heard any other reports of corrupted downloads, so I'm afraid it is something particular to your system, network, etc.

Checksum verification is a reasonable solution, at least for the primary server jar since sha1 is provided. Addressing all the various combinations of mod downloads will be a significant effort.

denizkoekden commented 1 year ago

So to understand the system a bit better: I mount the "/data"-Folder into a local folder called "/minecraft-data". This local folder then gets zipped "zip -r /minecraft-data" and then I rsync it to my backup storage and my backup storage unzips it, so I can easily modify the contains. When I start my server I do the same thing in reverse, so I zip it back, rsync it with rsync and unzip it locally and start the docker image. Yes there is a lot happening to the files. But the problem already starts when unzipping the files on my backup storage. Always the the .jar-Files are getting damaged. Other Files are fine, but the jar files get damaged. So I excluded them, but that only works for Auto-CF and Vanilla cause the docker can just reload them. But not for Forge, where I want to play my own mods. As they get damaged during the process. Not always but often. I am already looking at all the logs, trying some things in my system but maybe there is something commonly known for .jar files. Do they get damaged in the process of zipping them?

itzg commented 1 year ago

Jar files are simply zip files with the suffix changed, so there should be little to no mistreatment of them. Really every file is just a blob of bytes...now what could make a possible difference is if a file is open while being transferred, but since the server jar is only read, that shouldn't come into play.

So, are you finding the original download was fine but it's getting corrupted later on?

denizkoekden commented 1 year ago

I guess the original download is fine. So you can close this issue if you want. But maybe it would still be good to check the file integrity and redownload if the file is bad.

Regards

itzg commented 1 year ago

We can keep it open and I renamed it to reflect the different aspect of it.