docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

Partially-downloaded server jar's are not handled well at the moment, preventing container start

Open potomato opened this issue 1 year ago • 2 comments

Hi,

I've had a couple of cases recently where I've had to start and then quickly stop a new minecraft server container. The scripts have correctly started downloading the latest jar but the container was stopped before it had finished. On restarting the container I get Error: Invalid or corrupt jarfile minecraft_server.1.20.6.jar or similar, unsurprisingly.

I would make sense to me to first download into a temporary file with a modified name, then rename. On every start we could delete any partially-downloaded files matching the temporary pattern, and then continue to re-download if required.

I'm happy to do this work (I submitted a PR for the bedrock image a while back).

Would this be better to be done as part of your mc-image-helper get in that repo or in this one, perhaps in start-utils.sh?

Thanks for all your effort on this.

Container logs

[init] Setting initial memory to 1G and max to 1G
[init] Starting the Minecraft server...
Error: Invalid or corrupt jarfile minecraft_server.1.20.6.jar

potomato avatar May 22 '24 17:05 potomato

That's a really small window of failure; however, it's obviously not zero since you hit it 😄

You're right that if the mc-image-helper get operation were to download to a temp file and then move into the final location, then that would help close some of those failure windows. As for making the change there or start-utils then it is certainly viable either way, but seems slightly cleaner to enhance mc-image-helper.

So, if you're wanting to help out there, then that would be great. All I ask is that you make very small changes and feel free to send a draft PR with any initial changes you want to consider.

itzg avatar May 22 '24 21:05 itzg

This issue is stale because it has been open 30 days with no activity. Please add a comment describing the reason to keep this issue open.

github-actions[bot] avatar Jun 22 '24 02:06 github-actions[bot]