Unrecognized VM option 'UseCGroupMemoryLimitForHeap'

Hi,

We have been running CircleCI CI/CD on our Android project for quite some time now and today we started to see an error regarding the usage of UseCGroupMemoryLimitForHeap for the Virtual Machine when creating our executor:

Here is the error:

Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAM=3G
Picked up _JAVA_OPTIONS: -Xmx3200m -XX:+UnlockExperimentalVMOptions -    XX:+UseCGroupMemoryLimitForHeap
Unrecognized VM option 'UseCGroupMemoryLimitForHeap'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Exited with code exit status 1
CircleCI received exit code 1

Here the executor:

thrive-android-executor:
docker:
  - image: circleci/android:api-29
working_directory: ~/src
environment:
  _JAVA_OPTIONS: "-Xmx3200m -XX:+UnlockExperimentalVMOptions" # Temporarily removed for now: -XX:+UseCGroupMemoryLimitForHeap"
  JVM_OPTS: -Xmx3200m
  ## circle instances have 4g, set java maxram to 3G manually - java automatics are using bad data from cgroups and/or docker, so we have to manually override this.
  JAVA_TOOL_OPTIONS: "-XX:MaxRAM=3G"
  GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx3200m" -Dorg.gradle.parellel=false -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=4'
  TERM: dumb

Here is the job that fails:

download-android-dependencies:
description: "Download Android Dependencies"
steps:
  - run:
      name: Download Android Dependencies
      command: ./gradlew androidDependencies

Hi,

We updated the Java version in Android images from 8 to 11. You can read more about that in our announcement of the change here.

We recently added a support article about the changes customers may need to make

In your case, you’ll likely want to now add UseContainerSupport . This will make sure Java still uses cgroups to gather available memory information.

We do apologize for the disruption this causes your organization and please let us know of any other way we can be of assistance.

Regards,
Pawan Bahuguna