ansible-middleware/keycloak

duplicate keycloak_quarkus_java_opts (Xms Xmx) used

Closed this issue · 1 comments

SUMMARY

We can change the variable keycloak_quarkus_java_opts for java memory (the default value is -Xms1024m -Xmx2048m )

It's used in the templates/keycloak-sysconfig.j2 so the service is start with this option.

Sadly, it's also existing a Xms & Xmx attribut harcoded in the kc.sh as your can see :

grep Xms /opt/keycloak/keycloak-24.0.1/bin/kc.sh 
         JAVA_OPTS_KC_HEAP="$JAVA_OPTS_KC_HEAP -Xms64m -Xmx512m"

So, when start the keycloak service, it's using both argument .

Please found the full command used to start the service :

/etc/alternatives/jre_17/bin/java -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.err.encoding=UTF-8 -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8 -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/urandom -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:FlightRecorderOptions=stackdepth=512 -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -Xms64m -Xmx512m --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED -Xms1024m -Xmx2048m -Dkc.home.dir=/opt/keycloak/keycloak-24.0.1/bin/.. -Djboss.server.config.dir=/opt/keycloak/keycloak-24.0.1/bin/../conf -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dpicocli.disable.closures=true -Dquarkus-log-max-startup-records=10000 -cp /opt/keycloak/keycloak-24.0.1/bin/../lib/quarkus-run.jar io.quarkus.bootstrap.runner.QuarkusEntryPoint start --optimized --proxy-headers xforwarded
ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible [core 2.14.9]

COLLECTION VERSION
middleware_automation.keycloak 2.1.0  
STEPS TO REPRODUCE
  • Deploy keycloak quarkus with this role with any (don't care) attribut
  • See the command used to start keyclock (ps -ef -wwww | grep keycloak)
ps -ef -wwww | grep [k]eycloak
keycloak   34089       1  0 Mar28 ?        00:42:14 /etc/alternatives/jre_17/bin/java -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.err.encoding=UTF-8 -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8 -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/urandom -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:FlightRecorderOptions=stackdepth=512 -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -Xms64m -Xmx512m --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED -Xms1024m -Xmx2048m -Dkc.home.dir=/opt/keycloak/keycloak-24.0.1/bin/.. -Djboss.server.config.dir=/opt/keycloak/keycloak-24.0.1/bin/../conf -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dpicocli.disable.closures=true -Dquarkus-log-max-startup-records=10000 -cp /opt/keycloak/keycloak-24.0.1/bin/../lib/quarkus-run.jar io.quarkus.bootstrap.runner.QuarkusEntryPoint start --optimized
EXPECTED RESULTS

a unique Xms & Xmx arguement on the started service

/etc/alternatives/jre_17/bin/java ... ... -Xms1024m -Xmx2048m ... ...
ACTUAL RESULTS
/etc/alternatives/jre_17/bin/java ... ... -Xms64m -Xmx512m  ... ... -Xms1024m -Xmx2048m ... ...

Reproed; heap settings go in envvar JAVA_OPTS_KC_HEAP not JAVA_OPTS_APPEND