Openmrs : Heap space issue. Out of memory error

Hi,

One of our servers has been failing with the Heap space error. The openmrs app is running inside a docker container. The server is 8Gb and I see the heap size inside the openmrs app container is 1.69GB. Is there a way to increase the heap size?

Link to the docker compose file: https://pastebin.com/E1V5vtR0

Thanks, Sameer

@dkayiwa @mksd @mogoodrich @ssmusoke

@sameermotwani11 sorry I had misread your need, apologies.

Now when you build the docker container, there is a file in web setenv.sh with the following line

export JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms256m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=512m"

you can edit that as part of your build pipeline to change it to

export JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms256m -Xmx1256m -XX:PermSize=256m -XX:MaxPermSize=512m"

1 Like

Thanks. Will let you know, if that works.

An easier approach with Docker is to set the environment variable _JAVA_OPTIONS to something like -Xmx4G -Xms4G within the container. For example, a line like this in a docker-compose.yml:

    environment:
      - “_JAVA_OPTIONS=-Xmx4G -Xms4G“

should give you 4 gigabytes of heap.

2 Likes

Hi,

The following din’t work:

environment:
  - “_JAVA_OPTIONS=-Xmx4G -Xms4G“

but this did:

- _JAVA_OPTIONS='-Xmx4096m'

Thanks a ton.