9

I'm using - image: peopleperhour/dynamodb for a docker image in my CircleCI config file.

In CircleCI it's outputting the following.

Initializing DynamoDB Local with the following configuration:
Port:   8000
InMemory:   false
DbPath: /var/dynamodb_local
SharedDb:   false
shouldDelayTransientStatuses:   false
CorsParams: *


Exited with code 137

The first tests pass fine and Exited with code 137 doesn't happen until later on. But once that error happens all the tests start failing.

I saw this link and changed my code to the following with no luck.

  - image: peopleperhour/dynamodb
    environment:
        MAX_HEAP_SIZE: 2048m
        HEAP_NEWSIZE: 512m

Any ideas on how to fix this?

Charlie Fish
  • 18,491
  • 19
  • 86
  • 179
  • error code 137 is due to running out of memory. Can you monitor memory usage while running and run `dmesg` once your container crashes? – yamenk Aug 31 '17 at 09:39
  • Hey did you ever figure this out? I'm seeing the same thing in my builds using Amazon's dynamodb-local container. – davidmerrick Jul 29 '19 at 22:20

4 Answers4

2

I ran into the same issue. I ended up just using localstack for it, as the memory footprint seems to be lower.

My config for that container looks like:

- image: localstack/localstack
    environment:
      SERVICES: dynamodb:4570
      DEFAULT_REGION: us-west-2
davidmerrick
  • 1,027
  • 1
  • 10
  • 17
0

As a workaround, you can try to specify a restart policy for the container:

- image: peopleperhour/dynamodb
  restart: on-failure # Restart the container if it exits due to an error
  environment:
    MAX_HEAP_SIZE: 2048m
    HEAP_NEWSIZE: 512m
yamenk
  • 46,736
  • 10
  • 93
  • 87
0

You can try 3 other things.

1:

Add resource limits to your docker section of the config.yml resources:

            requests:
              memory: "2Gi"
            limits:
              memory: "4Gi"

The default resource is Medium with 2 vCPUs and 4GB of ram.

2:

Use Java option environment vars to set memory limits. https://circleci.com/blog/how-to-handle-java-oom-errors/

3:

If you are using a non-basic account you can tell Circleci to use a different machine resource_class. You have to have the performance plan for this. https://circleci.com/docs/2.0/configuration-reference/#resource_class

Stephen Lester
  • 348
  • 3
  • 16
0

I use the amazon/dynamodb-local container to start DynamoDB local on CircleCI. I was having the same issue and setting MAX_HEAP_SIZE and Java options through the container wasn't really working for me, either. I found that the best way to do this was to override the entry-point for the container:

docker:
- image: amazon/dynamodb-local:1.13.1
  entrypoint: java -Djava.library.path=./DynamoDBLocal_lib -Xmx256m -jar DynamoDBLocal.jar -sharedDb -port 8000
Woody1193
  • 7,252
  • 5
  • 40
  • 90