Updating Java Heap size while deploying/installing keycloak using bitnami/keycloak

474 Views Asked by At

I keep getting a OutOfMemoryError while deploying/installing keycloak using bitnami/keycloak in a Kubernetes pod.

2023-02-09 17:33:49,316 ERROR [org.jboss.threads.errors] (build-19) Thread Thread[build-19,5,build group] threw an uncaught exception: java.util.concurrent.RejectedExecutionException
        at org.jboss.threads.RejectingExecutor.execute(RejectingExecutor.java:38)
        at org.jboss.threads.EnhancedQueueExecutor.rejectException(EnhancedQueueExecutor.java:2049)
        at org.jboss.threads.EnhancedQueueExecutor.doStartThread(EnhancedQueueExecutor.java:1713)
        at org.jboss.threads.EnhancedQueueExecutor.execute(EnhancedQueueExecutor.java:787)
        at io.quarkus.builder.BuildContext.depFinished(BuildContext.java:261)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:294)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:829)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
        Suppressed: java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
                at java.base/java.lang.Thread.start0(Native Method)
                at java.base/java.lang.Thread.start(Thread.java:798)
                at org.jboss.threads.JBossThread.start(JBossThread.java:558)
                at org.jboss.threads.EnhancedQueueExecutor.doStartThread(EnhancedQueueExecutor.java:1709)
                ... 8 more

I suspect it could be because of the Java Heap size. Please correct me if I am wrong.

I have checked the resources allocated to the machine; everything looks fine. The question is how do I update the heap size in value.yaml file? Is JAVA_OPTS_APPEND in https://github.com/bitnami/charts/blob/main/bitnami/keycloak/templates/configmap-env-vars.yaml is the env variable to be overridden?

If anybody has an example, please share.

1

There are 1 best solutions below

0
Nicolas Roux On

On 16.0.0, I set:

extraEnvVars:
  - name: JAVA_OPTS_APPEND
    value: "-Xms2048m -Xmx4096m -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:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=9"