Troubleshooting Java heap and Metaspace OutOfMemory issues in Adobe Experience Manager 6.5.24
Learn how to diagnose and resolve Java heap and Metaspace OutOfMemory errors in AEM 6.5.24 Author and Publisher instances.
Description description
Environment
Adobe Experience Manager (AEM) 6.5.24 Author and Publisher instances, applicable to any deployment environment (development, staging, or production).
Symptoms
-
Significant increase in Java heap and/or Metaspace utilization over time.
-
Instances become unresponsive or crash due to repeated OutOfMemoryError conditions.
-
Error logs contain messages such as:
- java.lang.OutOfMemoryError: Java heap space
- org.osgi.framework.ServiceException: Service factory exception: Java heap space
-
Frequent error messages related to resource resolution failures, such as:
- Resource not found for actualpath errors when resolving non-existent page paths
- Model adaptation errors, (For example: model is null, page not found)
Cause
OutOfMemory conditions are primarily due to Java heap exhaustion associated with repeated resource resolution errors and application-level processing. There is no confirmed Metaspace-specific product defect in AEM 6.5.24. Further analysis of heap dumps and application code is required to isolate and remediate the root cause.
Resolution resolution
Follow the steps below to resolve the issue:
-
Collect diagnostic data:
-
Gather error logs, heap dumps, and thread dumps from both Author and Publisher instances at the time of the OutOfMemoryError.
-
Review garbage collection (GC) logs for evidence of Metaspace or Java heap exhaustion.
-
-
Analyze heap dumps:
-
Use a tool such as Eclipse Memory Analyzer (MAT) to identify objects or classes with the highest retained heap size.
-
Look for abnormal object retention, memory leaks, or excessive resource resolution activity.
-
-
Review application code:
-
Investigate custom code, especially components involved in resource resolution and model adaptation.
-
Address any patterns that can cause excessive memory retention or repeated errors.
-
-
Check for known issues:
-
Review the version of
org.apache.sling.jcr.resourcein use for any known issues related to resource listeners or session retention. -
Consult Adobe AEM release notes and Experience League forums (For example: the AEM Experience League Community) for any hotfixes or service packs addressing memory issues in AEM 6.5.24.
-
-
Optimize resource resolution:
-
Reduce unnecessary resource resolution attempts for non-existent paths.
-
Handle null model adaptations gracefully to avoid excessive error logging and memory usage.
-
-
Monitor and tune JVM settings:
-
Review and adjust JVM Metaspace and heap size parameters as appropriate for your workload.
-
Monitor memory trends after applying code and configuration changes.
-
After completing these steps, verify that memory utilization stabilizes and OutOfMemory errors no longer occur.