mark2devel / mark2

Minecraft Multi Server Wrapper Written in Python with Twisted; Pull Requests HIGHLY Encouraged, Collaborators Needed Discord: https://discord.gg/zymJygHNpv
Other
207 stars 44 forks source link

Support `java.cli_prepend` as first JVM options added. #109

Closed totemo closed 4 years ago

totemo commented 5 years ago

We'd like to try to follow Aikar's advice on GC tuning options, stated here. But expressing those options with java.cli.XX. settings in mark2.properties is impossible because dict order is arbitrary.

The JVM is unhappy if -XX:+UnlockExperimentalVMOptions does not precede the experimental options.

2019-02-23 01:07:46 # jvm options: -XX:+ParallelRefProcEnabled -Xms2G -Xmx2G -Djline.terminal=jline.UnsupportedTerminal -XX:G1MixedGCLiveThresholdPercent=35 -XX:G1MaxNewSizePercent=80 -XX:TargetSurvivorRatio=90 -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=100 -XX:G1NewSizePercent=50 -XX:+AlwaysPreTouch -XX:+UseG1GC
2019-02-23 01:07:46 | [RAW] Error: VM option 'G1MixedGCLiveThresholdPercent' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.
2019-02-23 01:07:46 | [RAW] Error: The unlock option must precede 'G1MixedGCLiveThresholdPercent'.
2019-02-23 01:07:46 | [RAW] Error: Could not create the Java Virtual Machine.
2019-02-23 01:07:46 | [RAW] Error: A fatal exception has occurred. Program will exit.
2019-02-23 01:07:46 # fatal error: A process has ended with a probable error condition: process ended with exit code 1.
2019-02-23 01:07:46 # mark2 stopped.

I don't know the mark2 code base well enough to derive Properties from collection.OrderedDict - mark2 locks up on start. Something to do with the way iteration is handled, I guess.

This PR adds the configuration property java.cli_prepend=<shell-quoted-jvm-args> so that Aikar's options can be expressed as:

java.cli_prepend=-XX:+UnlockExperimentalVMOptions     
java.cli.XX.UseG1GC=true
java.cli.XX.MaxGCPauseMillis=100
java.cli.XX.DisableExplicitGC=true
java.cli.XX.TargetSurvivorRatio=90
java.cli.XX.G1NewSizePercent=50
java.cli.XX.G1MaxNewSizePercent=80
java.cli.XX.G1MixedGCLiveThresholdPercent=35
java.cli.XX.AlwaysPreTouch=true
java.cli.XX.ParallelRefProcEnabled=true
Puremin0rez commented 5 years ago

You can use "java.cli-extra=" to do the java arguments raw without having to use the "java.cli.XX" in the mark2 config. I had the same issue as you until I figured this out myself many years ago.

"java-cli-extra=" will allow you to specify all the arguments straight up raw and in the exact order you put them in, just as if you were adding them to the end of your standard launch script.