-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
A change that was introduced in 8.12.2 (#15928), has altered the order of jvm options, causing Logstash to start, for example, with the wrong Heap size (Xmx / Xms) settings.
This bug comes from the nettyMaxOrderDefaultTo11 method that passes all settings through an HashSet. We can see the change by interacting with the java class directly, from 8.11.3:
❯ LS_JAVA_OPTS="-Xmx25g" /tmp/logstash-8.12.2/jdk.app/Contents/Home/bin/java -cp /tmp/logstash-8.11.3/logstash-core/lib/jars/jvm-options-parser-8.11.3.jar org.logstash.launchers.JvmOptionsParser . | grep Xmx --color
-Xms1g -Xmx1g -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.compile.invokedynamic=true -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/urandom -Dlog4j2.isThreadContextMapInheritable=true -Xmx25g -Djruby.regexp.interruptible=true -Djdk.io.File.enableADS=true --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio.channels=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED
to 8.12.2:
❯ LS_JAVA_OPTS="-Xmx25g" /tmp/logstash-8.12.2/jdk.app/Contents/Home/bin/java -cp /tmp/logstash-8.12.2/logstash-core/lib/jars/jvm-options-parser-8.12.2.jar org.logstash.launchers.JvmOptionsParser . | grep Xmx --color
-XX:+HeapDumpOnOutOfMemoryError -Dlogstash.jackson.stream-read-constraints.max-number-length=10000 --add-opens=java.base/java.nio.channels=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -Djruby.regexp.interruptible=true --add-opens=java.base/java.security=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -Dio.netty.allocator.maxOrder=11 -Dlog4j2.isThreadContextMapInheritable=true -Xms1g -Dlogstash.jackson.stream-read-constraints.max-string-length=200000000 -Djdk.io.File.enableADS=true -Dfile.encoding=UTF-8 -Xmx25g --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -Djruby.compile.invokedynamic=true -Xmx1g -Djava.security.egd=file:/dev/urandom -Djava.awt.headless=true --add-opens=java.base/sun.nio.ch=ALL-UNNAMED