Home:ALL Converter>CircleCI: How to Handle Java OOM Errors

CircleCI: How to Handle Java OOM Errors

Ask Time:2018-09-25T19:12:01         Author:alice

Json Formatter

Get OOM error when I run test on CircleCI, like this:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:testDebugUnitTest'.
> Process 'Gradle Test Executor 1' finished with non-zero exit value 137

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- 
debug option to get more log output. Run with --scan to get full insights.

Part of the configuration of my config.yml file:

version: 2
jobs:
  build-and-test:   
    working_directory: ~/carepilot-android/
    docker:
      - image: circleci/android:api-25-alpha

    environment:

      JVM_OPTS: -Xmx3200m             
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results

    steps:
      - checkout
    ...

I tried changing the "environment" configuration:

environment:
  TERM: dumb
  _JAVA_OPTIONS: "-Xms512m -Xmx1024m"     
  GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError" -Dorg.gradle.daemon=true'

or:

environment:
  JAVA_TOOL_OPTIONS: -Xmx1024m

I still get the OOM error.

Please help or try to give some ideas how to fix this.

Author:alice,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52496815/circleci-how-to-handle-java-oom-errors
yy