Expand my Community achievements bar.

SOLVED

How to overcome javaheap space problem : looking for solution

Avatar

Level 1

Hi all,


I'm currently facing the issue on AEM 6.3 version.
We are provisioning AEM using AWS and Terraform.
As soon as the ec2 spins up (Author instance/pub instance ), I get a problem that the java application doesn't start.

I normally do as work around:

./crx-quickstart/bin > ./status > to check the status > not connected
../crx-quickstart/bin > ./stop and ./start
and check the ./status again.

--------

i tried one method as well

./crx-quickstart/conf > sudo rm controlport

./crx-quickstart > ./stop and ./start again
.......
Even this method couldn't solve the problem.


Is there a feasible solution for this kind of problem.

how to check heap space:

ps -ef | grep java | grep Xmx ( example of publisher, same for author as well)


root 12790 12779 8 10:13 ? 00:11:47 java -Xmx4096M -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dadmin.password.file=/var/tmp/admin_passwordfile.properties -jar /opt/cq/p/cq-publish-4503.jar -p 4503 -r publish,samplecontent -nointeractive -nofork
root 19556 1 0 10:19 ? 00:00:44 java -server -Xmx2048m -XX:MaxPermSize=256M -Djava.awt.headless=true -Dsling.run.modes=publish,crx3,crx3tar -jar crx-quickstart/app/cq-quickstart-6.3.0-standalone-quickstart.jar start -c crx-quickstart -i launchpad -p 4503 -Dsling.properties=conf/sling.properties

 

Thanks

BR,Gopalam

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Gopalam,

At first, you would need to identify what is causing the heap space to grow What background threads or processes are consuming on your VM using Java or your AEM instance. There could be numerous reasons of Java heap space issue such as intensive resource consumption, unclosed resources in code base causing memory leaks, etc.

You can check using heap dump analysis. Check this post: http://www.aemcq5tutorials.com/tutorials/create-and-analyse-heap-dump-aem/

 

For a temporary workaround, you may be can try to increase the Xmx parameter for memory allocation but ideally the leakages if any should be fixed.

Hope this helps!

Jineet

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @Gopalam,

At first, you would need to identify what is causing the heap space to grow What background threads or processes are consuming on your VM using Java or your AEM instance. There could be numerous reasons of Java heap space issue such as intensive resource consumption, unclosed resources in code base causing memory leaks, etc.

You can check using heap dump analysis. Check this post: http://www.aemcq5tutorials.com/tutorials/create-and-analyse-heap-dump-aem/

 

For a temporary workaround, you may be can try to increase the Xmx parameter for memory allocation but ideally the leakages if any should be fixed.

Hope this helps!

Jineet

Avatar

Administrator
Thank you for answering this.


Kautuk Sahni

Avatar

Level 1

Hallo @Jineet_Vora

I have followed the approach.
I have a problem with "Getting OutOfMemoryError frequently in AEM Application".

Can we achieve by using automation? if you have any process, please guide me on this.

we normally monitor cpu utilization and other metrics in kibana , currently we are trying to create watcher( ELK) for heapspace to get alerts and monitor the AEM.

Did you try this kind of process to get alerts or other methods when the problem of outofmemoryError triggered.

 

please let me know.

Thanks for the inputs.

 

BR,Gopalam