'Exited with code 137' on free plan


I am getting the below error when running my tests:

Exited with code 137

Hint: Exit code 137 typically means the process is killed because it was running out of memory
Hint: Check if you can optimize the memory usage in your app
Hint: Max memory usage of this container is 67182592
 according to /sys/fs/cgroup/memory/memory.max_usage_in_bytes

The tests are relatively complex and rely on a number of microservices. There is no way to decrease the memory usage of any of the containers. I have tried every suggestion I have found on the internet to no avail. For example I have added the following to the top of my test:

      - image: my-base-image
        restart: on-failure # Restart the container if it exits due to an error
          MAX_HEAP_SIZE: 4096m
          HEAP_NEWSIZE: 1024m

It may also be relevant to know that I am running - setup_remote_docker to run multiple docker containers in my tests.

Is there any way to fix this issue? Am I required to pay for a package for my team to increase the memory resources available to us?

Your help will be much appreciated.

By default, I think you have a 4G limit in your Docker build container, and yes, normally to change this you need to be on a paid account. The machine sizes are here.

However, you can switch to a machine executor, which will give you 8G. Presently that is free, and has been for the last year or so, though it might become non-free in the future. I think that is your best bet for now.

If you can give more information about the number of containers you have and their individual memory requirements, I might be able to advise further. I am using ~10 micro-service containers in Docker Compose in a single CircleCI container, and it works very well. I don’t think my memory requirements are particularly onerous, though.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.