Out of memory error when >10 Platform sessions

We are setting up an Android client that communicates with an OpenMRS server using the RESTful API with basic authorization. We have a php middle layer that parses the REST calls from the client to a format that’s compatible with OpenMRS’s rest services module. Every time a REST call is made and a new session is automatically created. When the sessions exceed 10, we get an Out of Memory Error.

We also haven’t been able to get the jsessionid token to work using php.

We’ve already tried all the suggestions in: https://wiki.openmrs.org/display/docs/Performance+Tuning

Platform version: 1.11.5

How do we fix this? Thanks in advance.

What exactly is the Out of Memory Error you are seeing? The JVM memory settings are controlled by these JVM parameters:

-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m

What are the values you are using for those parameters? What is the output in the Memory Information section on the System Info page?

We are using the following parameters: -Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m

Memory Information Name Value Total Memory 123 MB Free Memory 2 MB Maximum Heap Size 123 MB

The arguments are not correctly being passed to the JVM. How exactly are you starting Tomcat and where are you specifying the arguments?

I’m specifying the parameters in /etc/default/tomcat6 as:

JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m -XX:+UseConcMarkSweepGC"

and starting Tomcat with:

sudo service tomcat6 start

You could try adding:

export JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m -XX:+UseConcMarkSweepGC"

to /usr/share/tomcat6/bin/setenv.sh and restarting Tomcat.

1 Like

Ah. That worked!

Memory Information Name Value Total Memory 494 MB Free Memory 268 MB Maximum Heap Size 494 MB


1 Like

Thanks @pascal !