From 9569ee4b988bc9ebed84093b6ee291753f74e195 Mon Sep 17 00:00:00 2001 From: Bert DEFERME Date: Thu, 18 Jan 2024 08:49:05 +0100 Subject: [PATCH] Make the java_maxmetaspace_size param optional. The default behaviour on most JVM versions is to have no limit for the Max Meta Space. While I understand wanting to set and limit it, in v3.0.0 this change is listed as an enhancement while actually being a breaking change. When one only reads the changelog without looking at the code, applications using more then the low default of 128MB will crash. --- manifests/init.pp | 2 +- templates/domain.conf.epp | 4 ++++ templates/standalone.conf.epp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index fd73dad..04a0470 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -85,7 +85,6 @@ Wildfly::Config_file $host_config = 'host.xml', String $java_xmx = '512m', String $java_xms = '256m', - String $java_maxmetaspace_size = '128m', String $package_ensure = 'present', Boolean $service_ensure = true, Boolean $service_manage = true, @@ -124,6 +123,7 @@ Optional[String] $package_name = undef, Optional[String] $package_version = undef, Variant[Undef, String, Array] $java_opts = undef, + Optional[Stdlib::Datasize] $java_maxmetaspace_size = undef, Variant[Undef, String, Array] $process_controller_java_opts = undef, Variant[Undef, String, Array] $host_controller_java_opts = undef, Optional[String] $jboss_opts = undef, diff --git a/templates/domain.conf.epp b/templates/domain.conf.epp index 6a73621..a8ca6da 100644 --- a/templates/domain.conf.epp +++ b/templates/domain.conf.epp @@ -42,7 +42,11 @@ fi # Specify options to pass to the Java VM. # if [ "x$JAVA_OPTS" = "x" ]; then + <% if $wildfly::java_maxmetaspace_size { -%> JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>" + <% } else { -%> + JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %>" + <% } -%> JAVA_OPTS="$JAVA_OPTS <% if $wildfly::java_opts =~ Array { -%> <%= $wildfly::java_opts.join(" ") -%> <% } elsif $wildfly::java_opts =~ String { -%> diff --git a/templates/standalone.conf.epp b/templates/standalone.conf.epp index 7041fe5..84c8b3e 100644 --- a/templates/standalone.conf.epp +++ b/templates/standalone.conf.epp @@ -47,7 +47,11 @@ fi # Specify options to pass to the Java VM. # if [ "x$JAVA_OPTS" = "x" ]; then + <% if $wildfly::java_maxmetaspace_size { -%> JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>" + <% } else { -%> + JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %>" + <% } -%> JAVA_OPTS="$JAVA_OPTS <%= $wildfly::java_opts %>" else echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"