java.lang.OutOfMemoryError:PermGen space

Hello! I was getting “java.lang.OutOfMemoryError: PermGen space” errors after a few days of running the product. I had set up the setenv.sh file with the below. But after another week, again I see this error in the logs (the web UI gets super slow when this happens and then crashes). Can you please verify this is enough space, since it has happened twice now? I went ahead and added swap space today as well. Thanks!

/opt/tomcat/bin# cat setenv.sh

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"

Yeah this is one of the reasons I recommend 4GB of RAM. If you have 4GB, I think you could live comfortably with the following memory settings.

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms2048m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=256m"

Otherwise, at 2GB of total RAM I might recommend these settings (which might be tight and cause some issues with MySQL).

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=128m"

What OS version are you on?

The reason I asked which OS you were on was because if you’re using Ubuntu, you can keep all of your configuration in the tomcat.service file.

https://docs.openboxes.com/en/latest/installation/ubuntu1804/tomcat/#create-service

We are using an ec2 t3.medium Ubuntu instance. The documentation specifies “Environment='CATALINA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=128m” for the tomcat.service file. I will make the adjustments you specified in your comment. Thank you!