Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0 #466

Closed
WaterKnight1998 opened this issue Mar 27, 2020 · 30 comments
Closed
Labels
status/waiting on feedback Waiting on feedback from author of issue

Comments

@WaterKnight1998
Copy link

The image has stopped working with next error:

Starting the Minecraft server...
Error occurred during initialization of VM
The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0
2020/03/27 22:59:05 Done
@itzg
Copy link
Owner

itzg commented Mar 28, 2020

Please provide information about how the container is setup, specifically the environment variables.

@lpulley
Copy link

lpulley commented Mar 28, 2020

I'm getting this as well. My container is running in an LXC in Proxmox, allocated 4 processors and 5GB RAM.

(Edit: This all worked perfectly in standard Ubuntu on bare metal. Doesn't work in LXC in Proxmox.)

Environment variables:

      - OVERRIDE_SERVER_PROPERTIES=true
      - EULA=true
      - DIFFICULTY=normal
      - OPS=myusername
      - MAX_PLAYERS=8
      - FORCE_GAMEMODE=true
      - SNOOPER_ENABLED=false
      - MODE=survival
      - MOTD=Example
      - PVP=true
      - INIT_MEMORY=512M
      - MAX_MEMORY=1G
      - ALLOW_FLIGHT=TRUE
      - VERSION=1.15.2

Edit: I just set this up and have been researching this issue. Funny that I found this post from 6hrs ago.

@wlp7s0
Copy link
Contributor

wlp7s0 commented Mar 28, 2020

I can't find any reference to the ParallelGCThreads option in the repository.

But you can always use JVM_XX_OPTS environment variable to override Java startup options.

   JVM_XX_OPTS: "-XX:+UseG1GC"

This should remove -XX:ParallelGCThreads from the startup

@WaterKnight1998
Copy link
Author

Please provide information about how the container is setup, specifically the environment variables.

It is inside an LXC in Proxmox with 11GB Ram and 4 processors.

It has being running good for two months until yesterday that I got this error.

@WaterKnight1998
Copy link
Author

JVM_XX_OPTS: "-XX:+UseG1GC"

@wlp7s0 I have tried launching it like this withouth exit.

docker run -d -p 25565:25565 --name minecraft_server -v /root/minecraftServer:/data --restart=always -e TYPE=SPIGOT -e VERSION=1.15.2 -e EULA=TRUE -e ONLINE_MODE=FALSE -e DIFFICULTY=normal -e MAX_PLAYERS=50 -e OVERRIDE_SERVER_PROPERTIES=true -e ALLOW_NETHER=true -e MEMORY=8G -e JVM_XX_OPTS="-XX:+UseG1GC" itzg/minecraft-server

@lpulley
Copy link

lpulley commented Mar 28, 2020

With JVM_XX_OPTS set to -XX:+UseG1GC I still get The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0.

@itzg has anything changed recently regarding JVM options?

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

Nothing in that area has changed and it’s especially strange since like @wlp7s0 mentioned, that other argument value doesn’t exist anywhere in the image files.

@wlp7s0
Copy link
Contributor

wlp7s0 commented Mar 29, 2020

Please provide information about how the container is setup, specifically the environment variables.

It is inside an LXC in Proxmox with 11GB Ram and 4 processors.

It has being running good for two months until yesterday that I got this error.

Can you tell us what did you do when you've got the error? This error can only be reproduced during docker image restart. Why did you need to restart it?

JVM_XX_OPTS: "-XX:+UseG1GC"

@wlp7s0 I have tried launching it like this withouth exit.

docker run -d -p 25565:25565 --name minecraft_server -v /root/minecraftServer:/data --restart=always -e TYPE=SPIGOT -e VERSION=1.15.2 -e EULA=TRUE -e ONLINE_MODE=FALSE -e DIFFICULTY=normal -e MAX_PLAYERS=50 -e OVERRIDE_SERVER_PROPERTIES=true -e ALLOW_NETHER=true -e MEMORY=8G -e JVM_XX_OPTS="-XX:+UseG1GC" itzg/minecraft-server

And you still have the same error? Try to stop the docker container, remove all docker's images, update git repository and build it again.

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

@lpulley or @WaterKnight1998, if you still have one in this state, can you add -e DEBUG_EXEC=true so that the logs will show exactly what arguments end up getting passed to java?

@lpulley
Copy link

lpulley commented Mar 29, 2020

can you add -e DEBUG_EXEC=true so that the logs will show exactly what arguments end up getting passed to java?

That gives me:

+ exec mc-server-runner --stop-duration 60s java -XX:+UseG1GC -Xms512M -Xmx1G -Dlog4j.configurationFile=/data/log4j2.xml -jar minecraft_server.1.15.2.jar

and of course still

The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0

(with JVM_XX_OPTS not set)

I did this after pulling itzg/minecraft-server:latest, with a fresh container.

EDIT: Full variables:

      - UID=0
      - GID=0
      - OVERRIDE_SERVER_PROPERTIES=true
      - EULA=true
      - DIFFICULTY=normal
      - OPS=usernameexample
      - MAX_PLAYERS=8
      - FORCE_GAMEMODE=true
      - SNOOPER_ENABLED=false
      - MODE=survival
      - MOTD=motdexample
      - PVP=true
      - INIT_MEMORY=512M
      - MAX_MEMORY=1G
      - ALLOW_FLIGHT=TRUE
      - VERSION=1.15.2
      - DEBUG_EXEC=true

@lpulley
Copy link

lpulley commented Mar 29, 2020

Figured I'd try setting JVM_XX_OPTS=-XX:+UseG1GC -XX:ParallelGCThreads=1 but that gives me

+ exec mc-server-runner --stop-duration 60s java -XX:+UseG1GC -XX:ParallelGCThreads=1 -Xms512M -Xmx1G -Dlog4j.configurationFile=/data/log4j2.xml -jar minecraft_server.1.15.2.jar
[16:27:20] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:27:20] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:27:20] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:27:20] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:27:20] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:27:20] [Server thread/INFO]: Starting minecraft server version 1.15.2
[16:27:20] [Server thread/INFO]: Loading properties
[16:27:20] [Server thread/INFO]: Default game type: SURVIVAL
[16:27:20] [Server thread/INFO]: Generating keypair
[16:27:21] [Server thread/INFO]: Starting Minecraft server on *:25565
[16:27:21] [Server thread/INFO]: Using epoll channel type
[16:27:21] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.ExceptionInInitializerError: null
   at xu.e(SourceFile:58) ~[minecraft_server.1.15.2.jar:?]
   at abn.a(SourceFile:16) ~[minecraft_server.1.15.2.jar:?]
   at xu.a(SourceFile:111) ~[minecraft_server.1.15.2.jar:?]
   at wd.d(SourceFile:164) ~[minecraft_server.1.15.2.jar:?]
   at net.minecraft.server.MinecraftServer.run(SourceFile:628) [minecraft_server.1.15.2.jar:?]
   at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.IllegalArgumentException: availableProcessors: 0 (expected: > 0)
   at io.netty.util.internal.ObjectUtil.checkPositive(ObjectUtil.java:44) ~[minecraft_server.1.15.2.jar:?]
   at io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:44) ~[minecraft_server.1.15.2.jar:?]
   at io.netty.util.NettyRuntime$AvailableProcessorsHolder.availableProcessors(NettyRuntime.java:70) ~[minecraft_server.1.15.2.jar:?]
   at io.netty.util.NettyRuntime.availableProcessors(NettyRuntime.java:98) ~[minecraft_server.1.15.2.jar:?]
   at io.netty.channel.MultithreadEventLoopGroup.<clinit>(MultithreadEventLoopGroup.java:41) ~[minecraft_server.1.15.2.jar:?]
   ... 6 more
[16:27:21] [Server thread/ERROR]: This crash report has been saved to: /data/./crash-reports/crash-2020-03-29_16.27.21-server.txt
[16:27:21] [Server thread/INFO]: Stopping server
[16:27:21] [Server thread/INFO]: Saving worlds
[16:27:21] [Server thread/ERROR]: Exception stopping the server
java.lang.NullPointerException: null
   at net.minecraft.server.MinecraftServer.a(SourceFile:559) ~[minecraft_server.1.15.2.jar:?]
   at net.minecraft.server.MinecraftServer.s(SourceFile:587) ~[minecraft_server.1.15.2.jar:?]
   at wd.s(SourceFile:597) ~[minecraft_server.1.15.2.jar:?]
   at net.minecraft.server.MinecraftServer.run(SourceFile:689) [minecraft_server.1.15.2.jar:?]
   at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
2020/03/29 16:27:21 Done

I should add that this is with a volume that has existing data in it. I'll try this with an empty volume and see what I get.
EDIT: Nope, same issue.

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

@lpulley thanks for the update...I'm still really confused where it's even getting the ParallelThreads argument since you can see it's not being passed along with the others.

Can you double check you have docker pulled the latest image? I am not able to recreate this issue. I created a new compose file based off your env listing and it worked fine:

version: '3'

services: 
  mc:
    image: itzg/minecraft-server
    environment: 
      - UID=0
      - GID=0
      - OVERRIDE_SERVER_PROPERTIES=true
      - EULA=true
      - DIFFICULTY=normal
      - OPS=usernameexample
      - MAX_PLAYERS=8
      - FORCE_GAMEMODE=true
      - SNOOPER_ENABLED=false
      - MODE=survival
      - MOTD=motdexample
      - PVP=true
      - INIT_MEMORY=512M
      - MAX_MEMORY=1G
      - ALLOW_FLIGHT=TRUE
      - VERSION=1.15.2
      - DEBUG_EXEC=true

and the logs
https://gist.github.com/itzg/24f53aea7f820f7c8f0fed77a5cfbb5c#file-logs-txt

@lpulley
Copy link

lpulley commented Mar 29, 2020

@itzg Just tried that Compose file exactly, after docker pull itzg/minecraft-server:latest. Same problem: https://gist.github.com/lpulley/b59716b6ba39013b5ea5f9adf8e9b726

I suspect it has something to do with the JVM running inside a Docker container inside LXC. Per my previous error log when I specified -XX:+UseG1GC -XX:ParallelGCThreads=1:

java.lang.IllegalArgumentException: availableProcessors: 0 (expected: > 0)

It seems that something is telling the JVM there are 0 processors available? Perhaps that's why ParallelGCThreads is being automatically set to 0 despite the term not being mentioned anywhere, and why I get an exception when I specify -XX:ParallelGCThreads=1?

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

Ah yes, I think you’re right that it’s something about LXC influencing this behavior. That makes me wonder if there’s a JVM option to disable that auto setting...

@lpulley
Copy link

lpulley commented Mar 29, 2020

Aha! -XX:ActiveProcessorCount seems to do the trick.
Logs: https://gist.github.com/lpulley/b8ba4be9584046ab50fb52befd143673
With JVM_XX_OPTS=-XX:+UseG1GC -XX:ParallelGCThreads=1 -XX:ActiveProcessorCount=6.

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

Excellent find! What you now remove -XX:ParallelGCThreads=1?

@lpulley
Copy link

lpulley commented Mar 29, 2020

Yup, was just about to mention that. Works fine without that. Some questions about that: In an LXC container with 6 allocated cores, running multiple containers of itzg/minecraft-server, will the JVMs all assume they're the only JVM on those 6 cores and go wild with garbage collection parallelization? Should I be using -XX:ActiveProcessorCount=1 rather than -XX:ActiveProcessorCount=6 or something like that?

@itzg
Copy link
Owner

itzg commented Mar 29, 2020

Thanks for confirming. Yes, you may want to scale back that value if running multiple minecraft containers. I believe with Java 9 and newer it becomes more container-aware to do a little better at guessing CPU and memory constraints within the container. There's image tags adopt11 and adopt13 if you want to experiment with that.

@lpulley
Copy link

lpulley commented Mar 29, 2020

Seems that itzg/minecraft-server:adopt11 and itzg/minecraft-server:adopt13 just work with no JVM_XX_OPTS set! I think adopt13 going to be my preferred solution for now, unless you don't recommend that build.

EDIT: Maybe adopt11 would be more stable?

@itzg
Copy link
Owner

itzg commented Mar 30, 2020

That’s very good to hear. Either should be totally fine. The only downside I know is that forge and/or some mods don’t work with versions other than Java 8.

@itzg itzg added the status/waiting on feedback Waiting on feedback from author of issue label Apr 19, 2020
@herenickname
Copy link

herenickname commented Jun 25, 2020

# docker run -d -p 0.0.0.0:25801:25565 -v /root/survival1:/data -e EULA=TRUE -e TZ=Europe/Moscow -e VERSION=LATEST -e TYPE=TUINITY -e SERVER_NAME=Survival1 -e MAX_PLAYERS=50 -e MAX_WORLD_SIZE=20000 -e SPAWN_PROTECTION=150 -e VIEW_DISTANCE=6 -e MOTD=CreeperLand -e ONLINE_MODE=false -e MEMORY=10G -e USE_AIKAR_FLAGS=true -e GUI=FALSE --name survival1 -i -t itzg/minecraft-server

# docker update survival1 --cpuset-cpus 5,6

# docker stop survival1

# docker start survival1

Error occurred during initialization of VM
The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0

@herenickname
Copy link

@itzg Can you help us? Do have any recommendations?

@itzg
Copy link
Owner

itzg commented Jun 25, 2020

@ekifox can you add -e DEBUG_EXEC=true and provide the output of the "exec mc-server-runner" log line? Since -XX:+UseG1GC is included in the default JVM options and the Aikar flags, the remaining mystery is where -XX:ParallelGCThreads=0 came from.

@herenickname
Copy link

herenickname commented Jun 26, 2020

@itzg

# docker run -d -e EULA=TRUE -e TZ=Europe/Moscow -e VERSION=LATEST -e TYPE=TUINITY -e MEMORY=10G -e USE_AIKAR_FLAGS=true -e GUI=FALSE --name survival2 -e DEBUG_EXEC=true itzg/minecraft-server

+ exec mc-server-runner --stop-duration 60s java -XX:+UseG1GC -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -Xms10G -Xmx10G -Dlog4j.configurationFile=/data/log4j2.xml -jar tunity-1.16.1-lastSuccessfulBuild.jar nogui

# docker stop survival2
# docker update survival2 --cpuset-cpus 5,6
# docker start survival2

+ exec mc-server-runner --stop-duration 60s java -XX:+UseG1GC -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -Xms10G -Xmx10G -Dlog4j.configurationFile=/data/log4j2.xml -jar tunity-1.16.1-lastSuccessfulBuild.jar nogui
Error occurred during initialization of VM
The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0
2020-06-26T03:18:32.782+0300	INFO	mc-server-runner	Done

Next, I tried to specify 1 and 3 cores, but still got such an error. Without --cpuset-cpus it works.
The Vanilla server works successfully with cores specifying. I caught this error only on spigot and tuinity servers.

@itzg
Copy link
Owner

itzg commented Jun 26, 2020

Strange. It seems like Spigot/Tuinity are triggering some special logic that detects the CPU configuration and auto-adjusts -XX:ParallelGCThreads. Sorry to have you keep experimenting with things, but can you also try the Java 11 or 13 based images using itzg/minecraft-server:adopt11 or itzg/minecraft-server:adopt13. I'm wondering if it's an issue with the Java 8 Alpine base image.

@lpulley
Copy link

lpulley commented Jun 28, 2020

To be clear from last time: I ended up running with itzg/minecraft-server:adopt13 and it worked fine! adopt11 worked as well.

@MightyDetail
Copy link

THX for this thread. I was searching for this error since Days. adopt13 worked for me too. Have not tested adopt11. Host was Proxmox with a Container for Docker. I was using PaperMC and maybe 2 or 3 weeks ago I got this error. Everything was fine before. On my other virtualisation platform everything works fine with the LATEST image. So there must be something with KVM or something like that.

@lpulley
Copy link

lpulley commented Aug 13, 2020

Yeah, latest worked on Docker on Ubuntu 18.04, but not on nested Docker in a Proxmox LXC. 🤷‍♂️

@aleskandro
Copy link

Yeah, latest worked on Docker on Ubuntu 18.04, but not on nested Docker in a Proxmox LXC. man_shrugging

Adding this to the proxmox lxc configuration worked in a similar issue:

lxc.cgroup.devices.allow: c 195:* rwm
lxc.cgroup.devices.allow: c 235:* rwm

@no-response
Copy link

no-response bot commented Dec 31, 2020

This issue has been automatically closed because there has been no response after requesting feedback. Please feel free to re-open this issue if the scenario still exists and provide a comment with more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/waiting on feedback Waiting on feedback from author of issue
Projects
None yet
Development

No branches or pull requests

7 participants