Highlighted

How to resolve out of memory error Java heap space

Qamar_khan

02-01-2019

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

Replies

Highlighted

WASIL

Employee

02-01-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

Highlighted

Qamar_khan

02-01-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

Highlighted

Qamar_khan

02-01-2019

Hi Wasil,

             Eclipse compilation warnings logs or AEM Error.log? And can you help me which kind of parameter I need to set for

this solution

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

Thanks

Qamar

Highlighted

Qamar_khan

02-01-2019

Hi Wasil,

             I have checked the AEM Error logs carefully and observed the below error repeatedly occurring

03.01.2019 00:04:49.722 *ERROR* [sling-threadpool-18ec3542-a5b7-481d-acbf-03ea9a230a95-(apache-sling-job-thread-pool)-5-com_day_cq_replication_job_publish(com/day/cq/replication/job/publish)] com.day.cq.replication.Agent.publish Error while sending request: java.net.ConnectException: Connection refused: connect

03.01.2019 00:04:49.722 *ERROR* [sling-threadpool-18ec3542-a5b7-481d-acbf-03ea9a230a95-(apache-sling-job-thread-pool)-5-com_day_cq_replication_job_publish(com/day/cq/replication/job/publish)] com.day.cq.replication.Agent.publish Replication (DELETE) of /content/dam/asset/text/english/2-copy/ani/2C_EN not successful: java.net.ConnectException: Connection refused: connect Conversation follows

Is this mainly causing heap memory problem or server hanging?

Can please suggest solution for this com.day.cq.replication.Agent.publish Error.

Thanks

Qamar

Highlighted

Opkar_Gill

Employee

03-01-2019

Hi Qamar,

make sure you have the minimum required amount of memory in your startup parameters, then use this page to Analyze Memory Problems.

Your error suggests the password in you replication may be incorrect. Can you open the agent and test the connection?

Regards,

Opkar

Highlighted

Qamar_khan

03-01-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.

ConnectionRefused.PNG

Thanks

Qamar

Highlighted

Opkar_Gill

Employee

03-01-2019

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

Highlighted

Qamar_khan

03-01-2019

Hi Opkar,

             Currently we are using one single instance on localhost port 4502 which I am thinking is author instance.

We have checked publish instance 4503 url which is currently stop in our AEM.

With the help of this post https://helpx.adobe.com/experience-manager/kb/error-com-day-cq-replication-impl-AgentManagerImpl-Job... we have disable the agent.

Is there any more setting required ?

Thanks

Qamar