3

When running my Play App, I often get the following error: java.lang.OutOfMemoryError: GC overhead limit exceeded I now want to increase the MaxHeapSize.

First, I applied the parameters to my startup script:

cd app_x
.../play/play-2.2.1/play clean compile stage
app_x/target/universal/stage/bin/app_x -J-Xmx3g

However, the parameters of the JVM stay the same. htop says java -Xms1024m -Xmx1024m ... for the process.

Then I configured the environment variable:

export _JAVA_OPTIONS="-Xmx3g"

I executed play test and got:

Picked up _JAVA_OPTIONS: -Xmx3g

However, the Xmx parameters of the JVM didn't change either.

Thank you for helping me.

Matthias Munz
  • 3,583
  • 4
  • 30
  • 47

2 Answers2

4

Option 1

Adding below settings to the Build.scala

javaOptions ++= Seq("-Xmx3g", "-Xms3g", "-XX:MaxPermSize=2048M")

Option 2

Add below to the VM options of your running terminal

$ JAVA_OPTS="-Xms3g -Xmx3g -XX:MetaspaceSize=2048M" ./activator start

-XX:MaxPermSize=92m

This is a default value, and in most cases you don’t need to change it. You may increase it only if you get “OutOfMemoryError” in “PermGen space”. In your case you might have to increase it.

There is still bugs faced by activator module

More information regarding the findings related to the problem GC overhead limit exceeded

Community
  • 1
  • 1
Keshan Nageswaran
  • 8,060
  • 3
  • 28
  • 45
4

It finally worked with the follwing parameters

/path/to/bin/<project-name> -mem 512 -J-server

as described here: https://www.playframework.com/documentation/2.2.x/ProductionConfiguration#Specifying-additional-JVM-arguments

Matthias Munz
  • 3,583
  • 4
  • 30
  • 47
  • Same in 2.8.x https://www.playframework.com/documentation/2.8.x/ProductionConfiguration#JVM-configuration – Ali Jul 17 '20 at 23:44