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.32k stars 1.53k forks source link

In Minecraft client server appears as OLD #430

Closed WaterKnight1998 closed 4 years ago

WaterKnight1998 commented 4 years ago

I am launching Minecraft 1.15.2 Server in RPI3 as follows:

docker run -d -p 25565:25565 --name minecraft_server -v /minecraftServer:/data -e EULA=TRUE -e ONLINE_MODE=FALSE itzg/minecraft-server:rpi3

In the Minecraft Client 1.15.2, the server appears as Old. Throught the process of establishing connection, I get a timeout in encryption phase.

WaterKnight1998 commented 4 years ago

I have tried using docker run -d -p 25565:25565 --name minecraft_server -v /minecraftServer:/data -e VERSION=1.14.3 -e EULA=TRUE -e ONLINE_MODE=FALSE -e OVERRIDE_SERVER_PROPERTIES=true -e ALLOW_NETHER=true itzg/minecraft-server:rpi3 and getting OLD message too.

itzg commented 4 years ago

Can you grab and provide some of the startup logs?

TBH, I have been disappointed with running Minecraft servers on raspberry pi ...it’s just a bit too underpowered.

itzg commented 4 years ago

Actually, stay tuned...it looks like the "rpi3" image tag is still using the wrong processor architecture. I'm going to do a build on my raspberrypi 3 and push that.

itzg commented 4 years ago

I pushed a new image and I see that it is correctly downloading 1.15.2 however, it's been stuck on the last command shown here for about 5 minutes now:

pi@rpi3:~ $ uname -a
Linux rpi3 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
pi@rpi3:~ $ docker run -it --rm -e EULA=TRUE itzg/minecraft-server:rpi3
Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx    2 1000     1000          4096 Feb  1 19:32 /data'
Checking version information.
Checking type information.
Downloading minecraft_server.1.15.2.jar ...
Creating server.properties in /data/server.properties
Setting server-name to 'Dedicated Server' in /data/server.properties
Setting server-port to '25565' in /data/server.properties
Setting motd to 'A Vanilla Minecraft Server powered by Docker' in /data/server.properties
Skip setting allow-nether
Skip setting announce-player-achievements
Skip setting enable-command-block
Skip setting spawn-animals
Skip setting spawn-monsters
Skip setting spawn-npcs
Skip setting spawn-protection
Skip setting generate-structures
Skip setting view-distance
Skip setting hardcore
Skip setting snooper-enabled
Skip setting max-build-height
Skip setting force-gamemode
Skip setting max-tick-time
Skip setting enable-query
Skip setting query.port
Setting enable-rcon to 'true' in /data/server.properties
Setting rcon.password to 'minecraft' in /data/server.properties
Setting rcon.port to '25575' in /data/server.properties
Skip setting max-players
Skip setting max-world-size
Setting level-name to 'world' in /data/server.properties
Skip setting level-seed
Setting pvp to 'true' in /data/server.properties
Skip setting generator-settings
Setting online-mode to 'true' in /data/server.properties
Skip setting allow-flight
Setting level-type to 'DEFAULT' in /data/server.properties
Skip setting resource-pack
Skip setting resource-pack-sha1
Setting difficulty to '1' in /data/server.properties
Checking for JSON files.
Copying any mods over...
Setting initial memory to 1G and max to 1G
Starting the Minecraft server...
OpenJDK Zero VM warning: G1 GC is disabled in this release.
WaterKnight1998 commented 4 years ago

Thank you, very much. I will give it a try now.

itzg commented 4 years ago

I think the Minecraft server crashed my whole RaspberryPi :( I left it alone to startup all the way and later wasn't able to SSH back into the rpi. Pulling the power cable and restarting fixed that :)

0xVox commented 4 years ago

I'm finding this "old" issue too while running in kubernetes on a pi4 4GB node behind mc-router. I've run both the rpi3 tag and the multiarch:armv7 tag both with the same problem.

itzg commented 4 years ago

@0xVox can you provide container startup logs?

0xVox commented 4 years ago

@0xVox can you provide container startup logs?

Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x    7 1000     1000          4096 Mar 24 14:44 /data'
Checking version information.            
Checking type information.               
server.properties already created, skipping                                                                 
Checking for JSON files.                 
Copying any mods over...                 
Setting initial memory to 1G and max to 1G                                                                  
Starting the Minecraft server...         
OpenJDK Zero VM warning: G1 GC is disabled in this release.                                                 
[14:46:51] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]      
[14:46:51] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]                                         
[14:46:51] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]                                             
[14:46:51] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]          
[14:46:51] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]                       
[14:46:51] [Server thread/INFO]: Starting minecraft server version 1.15.2                                   
[14:46:51] [Server thread/INFO]: Loading properties                                                         
[14:46:51] [Server thread/INFO]: Default game type: SURVIVAL                                                
[14:46:51] [Server thread/INFO]: Generating keypair                                                         
[14:47:02] [Server thread/INFO]: Starting Minecraft server on *:25565                                       
[14:47:03] [Server thread/INFO]: Using default channel type                                                 
[14:47:03] [Server thread/INFO]: Preparing level "world"                                                    
[14:47:06] [Server thread/INFO]: Found new data pack vanilla, loading it automatically                      
[14:47:06] [Server thread/INFO]: Reloading ResourceManager: Default                                         
[14:47:52] [User Authenticator #1/INFO]: UUID of player Goyface is 08a01e01-a8ce-49c0-b789-118e2b642237     

You can see the server in the server browser - it will say "old" and when you try to connect it will hang at the "Encryption" stage (And the server will produce the auth log you see on the last line above) but will time out shortly after.

There is a few minutes between the G1 GC warning and the timestamped logs.

itzg commented 4 years ago

Oops, since it didn't think it needed to re-download, the logs don't report what version it thinks it is using. What docker run or compose snippet are you using to pass VERSION. Can you also double check you have pulled the latest image?

0xVox commented 4 years ago
$ kubectl logs -n minecraft --follow minecraft-server-69cdc4d664-wfqtl
Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x    2 1000     1000          4096 Mar 25 17:26 /data'
Checking version information.
Checking type information.
Downloading minecraft_server.1.15.2.jar ...
Creating server.properties in /data/server.properties
Setting server-name to 'Dedicated Server' in /data/server.properties
Setting server-port to '25565' in /data/server.properties
Setting motd to 'A Vanilla Minecraft Server powered by Docker' in /data/server.properties
Skip setting allow-nether
Skip setting announce-player-achievements
Skip setting enable-command-block
Skip setting spawn-animals
Skip setting spawn-monsters
Skip setting spawn-npcs
Skip setting spawn-protection
Skip setting generate-structures
Skip setting view-distance
Skip setting hardcore
Skip setting snooper-enabled
Skip setting max-build-height
Skip setting force-gamemode
Skip setting max-tick-time
Skip setting enable-query
Skip setting query.port
Setting enable-rcon to 'true' in /data/server.properties
Setting rcon.password to 'lmaotest' in /data/server.properties
Setting rcon.port to '25575' in /data/server.properties
Skip setting max-players
Skip setting max-world-size
Setting level-name to 'world' in /data/server.properties
Skip setting level-seed
Setting pvp to 'true' in /data/server.properties
Skip setting generator-settings
Setting online-mode to 'true' in /data/server.properties
Skip setting allow-flight
Setting level-type to 'DEFAULT' in /data/server.properties
Skip setting resource-pack
Skip setting resource-pack-sha1
Setting difficulty to '1' in /data/server.properties
Checking for JSON files.
Copying any mods over...
Setting initial memory to 1G and max to 1G
Starting the Minecraft server...
OpenJDK Zero VM warning: G1 GC is disabled in this release.
[21:03:48] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[21:03:48] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[21:03:48] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[21:03:48] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[21:03:48] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[21:03:48] [Server thread/INFO]: Starting minecraft server version 1.15.2
[21:03:48] [Server thread/INFO]: Loading properties
[21:03:48] [Server thread/INFO]: Default game type: SURVIVAL
[21:03:48] [Server thread/INFO]: Generating keypair
[21:04:07] [Server thread/INFO]: Starting Minecraft server on *:25565
[21:04:07] [Server thread/INFO]: Using default channel type
[21:04:08] [Server thread/INFO]: Preparing level "world"
[21:04:10] [Server thread/INFO]: Found new data pack vanilla, loading it automatically
[21:04:10] [Server thread/INFO]: Reloading ResourceManager: Default

snippet from minecraft-server.yml deployment:

    spec:
      containers:
      - env:
        - name: EULA
          value: "true"
        - name: ENABLE_RCON
          value: "true"
        - name: RCON_PASSWORD
          value: *****
        image: itzg/minecraft-server:rpi3@sha256:61eb3c135db540eff27048743d6f162c91297cac23daf2003c72b67737d8c0a4
        imagePullPolicy: IfNotPresent
        name: minecraft-server
        ports:
        - containerPort: 25565
          name: main
          protocol: TCP

As you can see I haven't provided a "VERSION" - I assumed that without, it would pull the latest, and it does appear to do just that.

0xVox commented 4 years ago

I've spent some more time investigating this and it appears that actually this "old" message is just telling me this server hasn't started up properly yet.

But looking at these logs - it is taking an awfully long time. I realise this is a Pi I'm running it on, but the Pi4 4GB is quite significantly more powerful than the Pi3 - which I assume this image has worked well on before since you have an rpi3 tag?

I'll leave the server to load overnight and see what happens.

0xVox commented 4 years ago

I couldn't help myself - kept digging.

I found some bench results on different jvm implementations on ARM hardware - it seems the image you use is using an interpreter - you'll have to forgive me a little since I'm not really into the Java world so don't understand much about the ecosystem.

Anyway, having read the above I thought I'd have a crack at switching out the base image for something a little heavier but more performant - you can find my image here:

https://hub.docker.com/repository/docker/goyface/mc-server-rpi4-test

I'm using the bellsoft openjdk server runtime, and what was taking hours to even prepare the server now loads the server fully in roughly 5 mins - logs for comparison here:

Minecraft server w/ Bellsoft JRE 10 logs ``` $ kubectl logs -n minecraft --follow minecraft-server-5966bb4d6f-djbj7 [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 7 1000 1000 4096 Mar 25 22:29 /data' [init] Checking version information. [init] Checking type information. [init] server.properties already created, skipping [init] log4j2.xml already created, skipping [init] Checking for JSON files. [init] Copying any mods over... [init] Setting initial memory to 1500M and max to 1500M [init] Starting the Minecraft server... [22:32:18] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498] [22:32:18] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [22:32:18] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0] [22:32:18] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498] [22:32:18] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [22:32:19] [Server thread/INFO]: Starting minecraft server version 1.15.2 [22:32:19] [Server thread/INFO]: Loading properties [22:32:19] [Server thread/INFO]: Default game type: SURVIVAL [22:32:19] [Server thread/INFO]: Generating keypair [22:32:19] [Server thread/INFO]: Starting Minecraft server on *:25565 [22:32:19] [Server thread/INFO]: Using default channel type [22:32:20] [Server thread/INFO]: Preparing level "world" [22:32:20] [Server thread/INFO]: Found new data pack vanilla, loading it automatically [22:32:20] [Server thread/INFO]: Reloading ResourceManager: Default [22:32:33] [Server thread/INFO]: Loaded 6 recipes [22:32:34] [Server thread/INFO]: Loaded 825 advancements [22:33:48] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [22:33:48] [Server-Worker-1/INFO]: Preparing spawn area: 0% ** TRIMMED ** [22:36:36] [Server-Worker-1/INFO]: Preparing spawn area: 99% [22:36:36] [Server thread/INFO]: Time elapsed: 168757 ms [22:36:36] [Server thread/INFO]: Done (256.579s)! For help, type "help" [22:36:36] [Server thread/INFO]: Starting remote control listener [22:36:36] [RCON Listener #1/INFO]: RCON running on 0.0.0.0:25575 [22:36:39] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2152ms or 43 ticks behind ```

I would make a PR to change this but I'd like to test it and get your feedback first, also I was having some issues running your Dockerfile - specifically the easy-add tool you've made - seems to fetch your archives fine but then fails to find the binaries - so I've sloppily downloaded them myself and just COPY'd them in my Dockerfile.

My Dockerfile ```Dockerfile FROM bellsoft/liberica-openjdk-alpine:10.0.2-armv7l LABEL maintainer "itzg" RUN apk add --no-cache -U \ openssl \ imagemagick \ lsof \ su-exec \ shadow \ bash \ curl iputils wget \ git \ jq \ mysql-client \ tzdata \ rsync \ nano HEALTHCHECK --start-period=1m CMD mc-monitor status --host localhost --port $SERVER_PORT RUN addgroup -g 1000 minecraft \ && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \ && mkdir -m 777 /data /mods /config /plugins \ && chown minecraft:minecraft /data /config /mods /plugins /home/minecraft EXPOSE 25565 25575 # hook into docker BuildKit --platform support # see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope ARG TARGETOS=linux ARG TARGETARCH=arm ARG TARGETVARIANT="v7" ARG EASY_ADD_VER=0.6.0 ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add RUN chmod +x /usr/bin/easy-add ##RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ ## --var version=1.2.1 --var app=restify --file {{.app}} \ ## --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz ## ##RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ ## --var version=1.4.7 --var app=rcon-cli --file {{.app}} \ ## --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz ## ##RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ ## --var version=0.1.7 --var app=mc-monitor --file {{.app}} \ ## --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz ## ##RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ ## --var version=1.3.3 --var app=mc-server-runner --file {{.app}} \ ## --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz ## ##RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ ## --var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \ ## --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz COPY depend/mc-monitor /usr/local/bin COPY depend/restify /usr/local/bin COPY depend/rcon-cli /usr/local/bin COPY depend/mc-server-runner /usr/local/bin COPY depend/maven-metadata-release /usr/local/bin COPY mcstatus /usr/local/bin RUN chmod +x /usr/local/bin/mc-monitor; chmod +x /usr/local/bin/restify; chmod +x /usr/local/bin/rcon-cli; \ chmod +x /usr/local/bin/mc-server-runner; chmod +x /usr/local/bin/maven-metadata-release; \ chmod +x /usr/local/bin/mcstatus VOLUME ["/data","/mods","/config"] COPY server.properties /tmp/server.properties COPY log4j2.xml /tmp/log4j2.xml WORKDIR /data ENTRYPOINT [ "/start" ] ENV UID=1000 GID=1000 \ JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ RESOURCE_PACK= RESOURCE_PACK_SHA1= \ LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \ REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_" COPY start* / RUN dos2unix /start* && chmod +x /start* ```
The easy-add issue ``` Step 13/26 : RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} --var version=1.2.1 --var app=restify --file {{.app}} --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz ---> Running in fff42f19f21a 2020/03/25 21:56:08 I! Retrieving https://github.com/itzg/restify/releases/download/1.2.1/restify_1.2.1_linux_armv7.tar.gz 2020/03/25 21:56:15 E! unable to find requested file in archive ```
itzg commented 4 years ago

A lot of great information here to digest. A quick question I have at first is what led you to select the bellsoft JVM?

0xVox commented 4 years ago

A lot of great information here to digest. A quick question I have at first is what led you to select the bellsoft JVM?

Nothing clever, it was just the first one I found with a working ARM image.

I have a new problem now though, which I think will lead me to choose a different JVM image.

When connecting to the server, which now displays correctly in the client, the client and server both log out:

[22:47:12] [User Authenticator #1/INFO]: Disconnecting com.mojang.authlib.GameProfile@ad65d3[id=<null>,name=Goyface,properties={},legacy=false] (/10.244.1.41:42058): Authentication servers are down. Please try again later, sorry!
[22:47:12] [User Authenticator #1/ERROR]: Couldn't verify username because servers are unavailable

This Reddit thread implies that it's something to do with OpenJDK - I'll try and find a different one and have a crack at it.

itzg commented 4 years ago

I'm going to re-image my RaspberryPi 3 B+ and try out some different JVMs, such as https://hub.docker.com/_/adoptopenjdk . BTW, I'll need to completely revive that rpi3 tag since I haven't refreshed it from the mainline in quite a while.

itzg commented 4 years ago

...BTW, the multiarch branch is now Debian based in order to allow more flexibility in multiarch JVM base images

https://github.com/itzg/docker-minecraft-server/tree/multiarch

itzg commented 4 years ago

...oh, it's already using adoptopenjdk's JRE HotSpot image. Perhaps give itzg/minecraft-server:multiarch a try.

0xVox commented 4 years ago

...oh, it's already using adoptopenjdk's JRE HotSpot image. Perhaps give itzg/minecraft-server:multiarch a try.

This suffers the same slowness that the rpi3 image has unfortunately.

The problem exists when the output of java -version contains this: OpenJDK Zero VM (AdoptOpenJDK)(build 25.232-b09, interpreted mode)

Specifically "interpreted mode" - the running everything through the interpreter I think is what's causing the performance drop.

EDIT: Success!

Logs using adoptopenjdk/openjdk11:armv7l-debian-jdk-11.0.6_10 ``` $ kubectl logs -n minecraft --follow minecraft-server-6f58cdbbcf-sw5k2 Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 7 1000 1000 4096 Mar 26 00:42 /data' Checking version information. Checking type information. server.properties already created, skipping Checking for JSON files. Copying any mods over... Setting initial memory to 1500M and max to 1500M Starting the Minecraft server... [01:16:19] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498] [01:16:19] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [01:16:19] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0] [01:16:19] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498] [01:16:19] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [01:16:19] [Server thread/INFO]: Starting minecraft server version 1.15.2 [01:16:19] [Server thread/INFO]: Loading properties [01:16:19] [Server thread/INFO]: Default game type: SURVIVAL [01:16:19] [Server thread/INFO]: Generating keypair [01:16:20] [Server thread/INFO]: Starting Minecraft server on *:25565 [01:16:20] [Server thread/INFO]: Using default channel type [01:16:20] [Server thread/INFO]: Preparing level "world" [01:16:21] [Server thread/INFO]: Reloading ResourceManager: Default [01:18:41] [Server thread/INFO]: Loaded 6 recipes [01:18:42] [Server thread/INFO]: Loaded 825 advancements [01:18:43] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [01:18:49] [Server thread/INFO]: Preparing spawn area: 0% *** TRIMMED *** [01:19:27] [Server thread/INFO]: Preparing spawn area: 98% [01:19:27] [Server thread/INFO]: Time elapsed: 44459 ms [01:19:27] [Server thread/INFO]: Done (187.045s)! For help, type "help" [01:19:27] [Server thread/INFO]: Starting remote control listener [01:19:27] [RCON Listener #1/INFO]: RCON running on 0.0.0.0:25575 [01:19:42] [User Authenticator #1/INFO]: UUID of player Goyface is 08a01e01-a8ce-49c0-b789-118e2b642237 [01:19:42] [Server thread/INFO]: Goyface[/10.244.1.44:44626] logged in with entity id 91 at (152.5, 72.0, 58.5) [01:19:42] [Server thread/INFO]: Goyface joined the game [01:19:46] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2004ms or 40 ticks behind [01:19:51] [Server thread/INFO]: Goyface lost connection: Disconnected [01:19:51] [Server thread/INFO]: Goyface left the game ```
java -version ``` root@minecraft-server-6f58cdbbcf-sw5k2:/data# java -version openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10) OpenJDK Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode) ```

Running from this image I get a loadup time about a minute longer than with the Bellsoft image - but the server WORKS! I can join into it now!

To clarify, this is your multiarch image with the FROM line replaced with

FROM adoptopenjdk/openjdk11:armv7l-debian-jdk-11.0.6_10

There was an error getting mysql-client in the image build but in my haste I just removed it - what's that there for?

EDIT2: Performance is not great (Noticeable lag, one timeout, server logs complaining of running multiple hundred ticks behind) - but it works - I think we could benefit from finding an image that runs not in "mixed" or "interpreted" mode - I'll explore that more tomorrow. I imagine the Pi is somewhat limiting, but surely it can handle just one client running on the same network as it without these issues? I intend to run this for just up to 5 people at a time - with all except me external to the network, and I'm sure that must be achievable, right?

itzg commented 4 years ago

@0xVox thanks for the update. I ran out of patience even waiting for the incredibly slow docker build process on my rpi 3 B+. Even an ARG statement would take about 10-20 seconds, which is crazy slow compared to all other hardware I have used.

Where I left off was pushing an armv7 branch with a base image that probably ends up being the same as what you found:

https://github.com/itzg/docker-minecraft-server/blob/0db8780ad9a69f9f3957015c655d16909b8c523d/Dockerfile#L1

I used a similar analysis as you and also started one with -e JVM_XX_OPTS="-XX:+PrintCompilation" to confirm methods were getting JIT compiled during startup.

I think I'll have to leave it at that after adding armv7 to the versions update script at

https://github.com/itzg/docker-minecraft-server/blob/9d48e79c643ba4563c06d91a853bf055b96fb455/docker-versions-create.sh#L4

With that, it will ensure I keep that branch up to date with the mainline (master branch) changes.

itzg commented 4 years ago

...FYI, I introduced a new branch because the Docker BuildKit mechanism used with the multiarch branch doesn't allow for alternate base images per target os/arch/variant :(

0xVox commented 4 years ago

Great work mate, your branch looks good - only one small issue is that you haven't release an "armv7" easy-add - so when it tries to download it it fails. I just edited the dockerfile locally to use the "armv6" binary and it worked great - none of the issues I had with it above appeared :)

This "Mixed mode" runs interpreted at startup to collect execution metrics but then runs compiled thereafter - so I think this is the way forward.

I think this issue can be closed, for anyone looking for a TLDR:

"Old" appears when the server hasn't finished loading yet, the image you're running may be running java in interpreted mode which makes it incredibly slow especially on Pi hardware. Images have been updated to run a JVM in mixed mode - which I explained above. This improved performance drastically on my rpi4.

Cheers @itzg - coffee coming your way.

itzg commented 4 years ago

Oops, I did the bad thing :) and pushed that branch without retesting that final change to the easy-add version. CircleCI/Github was being flaky that day, so I'll see if I can redo that release build...

itzg commented 4 years ago

and coffee much appreciated @0xVox

itzg commented 4 years ago

I fixed the armv7 branch and also pushed a build of the image at itzg/minecraft-server:armv7.

stewe93 commented 4 years ago

Hello guys! First of all, really nice to see active development like this, thanks @itzg and everyone involved!

I tried the armv7 image with the following docker compose config on RPI4 4GB variant:

version: '3.7'

services:
  mc:
    image: itzg/minecraft-server:armv7
    container_name: mc
    restart: unless-stopped
    environment:
      EULA: "true"
      TYPE: "PAPER"
      VERSION: "1.15.2"
      WHITELIST: "name1, name2"
      ALLOW_NETHER: "true"
      ANNOUNCE_PLAYER_ACHIEVEMENTS: "true"
      SNOOPER_ENABLED: "false"
      ONLINE_MODE: "false"
      MEMORY: "2G"
      GUI: "false"
      JVM_XX_OPTS: "-XX:+UnlockExperimentalVMOptions -XX:ActiveProcessorCount=3"
    command: --noconsole
    ports:
      - 25565:25565
    volumes:
      - ${PWD}:/data

The server start time is about 4 minutes now, with the multiarch variant it took one night long to prepare the spawn area then the rpi crashed, so its good for now I think.

I could login successfully but right after login I get this message and after it sometimes too:

[13:43:36] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5077ms or 101 ticks behind
[13:44:15] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 8978ms or 179 ticks behind
[13:46:20] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5343ms or 106 ticks behind

(To be honest, I'm just started tinkering with minecraft 3 days ago, never played or deployed a server before)

I found this project based on PaperMC as well and applied the JVM options used there as:

JVM_XX_OPTS: "-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled" 

and of course restarted the container. Right after server start I get a "Cant keep up" message but while playing nothing in the server logs, only the game is a bit laggy (=sometimes stuck for a millisec but playable), maybe its a client problem I dont know. Im not a JVM expert so dont blame me if any of the above options is complete nonsense :)

If you would like, I can test any changes really fast, just let me know!

(ps: Could you suggest a good seed for a first time map? Right now the generated is a small island in the middle of the ocean and I dont think its great to start :D )

stewe93 commented 4 years ago

Nevermind the JVM options, after a longer test period, still getting the "Cant keep up" message

0xVox commented 4 years ago

@stewe93 I also get the same little bit of lag and those messages - I'm not sure what further optimization can be made - the paper mc server does seem to have better performance but as you said - same issues.

I'll have a crack at it in the next few days, maybe it's just limitations of running this on a Pi, but I would expect better from the larger Pi4 variant.

itzg commented 4 years ago

@stewe93 thanks for the info and that's a bummer the extra JVM args didn't help.

As for a seed, yeah, world generation where it creates an island in an ocean suck :) I usually wipe and rebuild the server when that happens. Otherwise, you can google around for some good seeds to use such as

https://www.gamesradar.com/best-minecraft-seeds/

itzg commented 4 years ago

I'll mark this issue closed, but we can continue to share findings here or over in the Discord channel https://discord.gg/DXfKpjB

0xVox commented 4 years ago

Nevermind the JVM options, after a longer test period, still getting the "Cant keep up" message

Hey guys, I think I've found the bottleneck on my end: IO speed.

Check out the benchmarks here: https://jamesachambers.com/raspberry-pi-storage-benchmarks-2019-benchmarking-script/

I was running this server with the data volume on a mid range Sandisk microSD card, which claims to run at 100MB/s - this doesn't seem to be true and the drive scored a terrible 1111 points on their benchmark.

     Category                  Test                      Result     
HDParm                    Disk Read                 39.92 MB/s
HDParm                    Cached Disk Read          33.49 MB/s
DD                        Disk Write                14.1 MB/s
FIO                       4k random read            3143 IOPS (12572 KB/s)
FIO                       4k random write           763 IOPS (3055 KB/s)
IOZone                    4k read                   10880 KB/s
IOZone                    4k write                  3490 KB/s
IOZone                    4k random read            9423 KB/s
IOZone                    4k random write           2441 KB/s

                          Score: 1111            

Running the same bench on my 1TB USB3.0 Portable HDD scored ~6x higher:

     Category                  Test                      Result     
HDParm                    Disk Read                 25.77 MB/s
HDParm                    Cached Disk Read          31.53 MB/s
DD                        Disk Write                22.9 MB/s
FIO                       4k random read            13438 IOPS (53753 KB/s)
FIO                       4k random write           1590 IOPS (6360 KB/s)
IOZone                    4k read                   67968 KB/s
IOZone                    4k write                  17168 KB/s
IOZone                    4k random read            67741 KB/s
IOZone                    4k random write           16935 KB/s

                          Score: 6185                                      

The most important metrics here are the 4k rand read/write scores - and you can see the microSD performs awfully in those metrics. The HDD absolutely blows it out of the water.

The result when I ran the server with the data volume on the higher scoring drive was much more promising - far fewer "Can't keep up" messages - and when they did appear they were never more than 105 ticks behind.

I've ordered a USB3 Solid State drive - one near the top scoring on those benchmarks (SanDisk Extreme Portable SSD 250 GB 550 MB/s) - and I'll report back with the results.

Can't believe I missed this metric to be honest - but now I think we can comfortable say we have a route to running this on a Pi with better results!

Update: With the faster drive, this server is booting in 80 seconds, I also bumped it up to use 2750MB of memory. Not bad! Oh, yeah, and if you're going to play with fire or TNT (In the server ;P ) - make sure you've got a fan on your Pi!