Bug: Sonar v9.9 does not respect Compute Engine memory increases

We are currently running a 9.8 version of Sonar w/ no issues. When upgrading to 9.9, we’ve noticed that even though env variables for increased memory exist, they are not applied to the deployment.

The portion of our values.yaml in question:


sonarqube:
  deploymentType: "Deployment"
  edition: "developer"
  env:
    - name: SONAR_CE_JAVAOPTS
      value: "-server -Xmx2G -Xms2G -XX:+HeapDumpOnOutOfMemoryError"
    - name: SONAR_SEARCH_JAVAOPTS
      value: "-server -Xmx6G -Xms6G -XX:MaxDirectMemorySize=1G -XX:+HeapDumpOnOutOfMemoryError"

Edit:

This also doesn’t work if we do:

sonarProperties:
  sonar.ce.javaOpts: "-server -Xmx2G -Xms2G -XX:+HeapDumpOnOutOfMemoryError"

in our helm chart – which is the other recommended way to do it. We’ve tried it three ways (env and sonarprops, just env, just sonarprops).

Hi,

To be sure, how do you know your envvars aren’t being applied?

 
Ann

When the SonarQube instance is live, I can verify via the UI (and startup logs) that the Compute Engine receives 512mb max memory, the default amount. My settings are ignored. If I shell into the running pod, I can see the environment variable exists; if I cat /opt/sonarqube/conf/sonar.properties, I can see the file is properly filled out with my desired settings

SONAR_SEARCH_JAVAOPTS work perfectly fine, it’s only SONAR_CE_JAVAOPTS and SONAR_WEB_JAVAOPTS that have issues.

Hi,

Thanks for verifying. I’m out of my depth, so I’ve called for more expert eyes.

 
Ann

Hi @pengcakes,

thanks for triggering this discussion and helping us with spotting a bug (we describe it here SQHELM-121).

You’re right, SONAR_CE_JAVAOPTS and SONAR_WEB_JAVAOPTS are overridden at the moment. If you want to set jvm opts, you have to use jvmCeOpts and jvmOpts respectively. This is actually also described in our ArtifactHub docs.

Please let us know if setting those values solves your issue. We will anyways fix this bug in the context of SQHELM-121, and thanks again for reporting :slight_smile:

1 Like