How to resolve out of memory error Java heap space | Community
Skip to main content
Level 3
January 2, 2019

How to resolve out of memory error Java heap space

  • January 2, 2019
  • 2 replies
  • 38253 views

Hello All,

             We have implemented java sling servlet rest API for AEM 6.4 version. We are facing  out of memory error at regular time interval and server hanging.

Can someone help how to resolve it ? or is it due java sling servlet implementation or due to some server configuration issue.

Thanks

Qamar

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Adobe Employee
January 2, 2019

Increase heap size first. Use correct memory parameters[1] either with jar or <crx-quickstart folder>/bin/start script when starting AEM instance.

Check your servlet/custom code for any possible memory leaks.

Thanks,

Wasil

[1] Increase java heap size – /home/edivad

Level 3
January 2, 2019

Thanks Wasil for  quick reply,

1.Increase heap size first [I have done this]

After posting this I have found below solution and I have done this also just one question,Is warnings also reason of it?

2. Check your servlet/custom code for any possible memory leaks [I have done this]

I will try this and update you result

3.Use correct memory parameters[1] either with jar or <crx-quickstart folder>/bin/start script

Thanks

Qamar

Adobe Employee
January 3, 2019

Thanks Opkar for reply,

            Earlier this post in our AEM6.4 we had increased the heap size in parameter of stat.bat file and quickstart.bat file as

if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=1024M -Djava.awt.headless=true

which suggested in Analyze Memory Problems. ​.  But still we were facing the server hanging issue.

1.Secondly  we have tried this CQ_JVM_OPTS='-XX:+HeapDumpOnOutOfMemoryError' change which suggested in Analyze Memory Problems Page but in this case AEM were not stating.

2.For agent and test the connection from (/etc/replication/agents.author/publish.html)

we have tried but getting below attached error.

Can you please tell me what is going wrong in AEM6.4 server setting or java bundle.

Thanks

Qamar


Hi Qamar,

the replication agent appears to be configured to point to localhost:4503, the default setting, which is used when running author and publish on the same local instance. If you are not running both on the same instance, add the correct url, also have you set the correct username and password for the publish instance? Follow this page to configure your Replication agent.

Regards,

Opkar

raj_mandalapu
Level 7
January 8, 2019

Hi Qamar, Performance issue is not a simple thing and it depends on multiple factors.

1. What could be ideal size heap memory for AEM6.4

   It depends on mulitple factors.

  1.      Total how many users are going to hit your server?
  2.      How frequently you are updating content?
  3. What is the DAM content size?
  • etc.

2.Second what can causing this server slow running behavior in our case

When you upload Assets, internally the workflows will trigger, request you disable and try once. What is the size of Assets you are uploading? Please double check your code on closing resourceResolvers properly? is it happening on bulk upload or only for a single asset? How many users are parallelly accessing your server at a time?

You can download thread dumps and check where the problem is?

Level 2
September 14, 2023

Hey you can increase your java heap size using this command just update your jar name.

java -Xmx1024m -jar aem-jar-name.jar