Expand my Community achievements bar.

SOLVED

Meta Space Error in AEM instaces

Avatar

Level 6

Hi All,

 

Sometimes, we are getting below error, especially in Author instances:

 

akhilraj_0-1712223119002.png

 

Caused by: java.lang.OutOfMemoryError: Metaspace
04.04.2024 02:15:56.627 *ERROR* [FelixDispatchQueue] org.apache.sling.servlets.resolver FrameworkEvent ERROR (org.osgi.framework.ServiceException: Service factory exception: Metaspace)
org.osgi.framework.ServiceException: Service factory exception: Metaspace


Any idea, how we can resolve these issues?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The "java.lang.OutOfMemoryError: Metaspace" error in Adobe Experience Manager (AEM) indicates that the JVM's Metaspace memory has been exhausted. Metaspace is a part of the Java Virtual Machine (JVM) that is responsible for storing metadata about classes and methods.

To fix this error in AEM, you can try the following steps:

  1. Increase Metaspace Size:

    • Increase the Metaspace size by adjusting the JVM memory settings in the AEM startup script (e.g., setenv or start.bat).
    • Increase the Metaspace size by adding the following JVM options:
      -XX:MaxMetaspaceSize=<size>

    Replace <size> with an appropriate value, such as 256m or 512m, depending on your system's available memory and requirements.

  2. Review and Optimize Code:

    • Review your AEM application code and identify any memory-intensive operations or memory leaks.
    • Optimize your code to reduce memory usage, such as by closing resources properly and avoiding unnecessary object creation.
  3. Increase Overall JVM Memory:

    • If increasing Metaspace size alone does not resolve the issue, consider increasing the overall JVM memory (Heap and Metaspace).
    • Adjust the JVM options for Heap memory using -Xmx and -Xms parameters.
  4. Check for Memory Leaks:

    • Use profiling tools or memory analyzers to identify and address any memory leaks in your AEM application.
  5. Review AEM Configuration:

    • Review the AEM configuration and ensure that it is optimized for performance and memory usage.
    • Check for any misconfigurations or excessive memory usage in AEM components or services.
  6. Monitor and Tune:

    • Monitor the AEM instance regularly for memory usage and performance metrics.
    • Tune the JVM memory settings as needed based on monitoring data and performance testing.

 



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

The "java.lang.OutOfMemoryError: Metaspace" error in Adobe Experience Manager (AEM) indicates that the JVM's Metaspace memory has been exhausted. Metaspace is a part of the Java Virtual Machine (JVM) that is responsible for storing metadata about classes and methods.

To fix this error in AEM, you can try the following steps:

  1. Increase Metaspace Size:

    • Increase the Metaspace size by adjusting the JVM memory settings in the AEM startup script (e.g., setenv or start.bat).
    • Increase the Metaspace size by adding the following JVM options:
      -XX:MaxMetaspaceSize=<size>

    Replace <size> with an appropriate value, such as 256m or 512m, depending on your system's available memory and requirements.

  2. Review and Optimize Code:

    • Review your AEM application code and identify any memory-intensive operations or memory leaks.
    • Optimize your code to reduce memory usage, such as by closing resources properly and avoiding unnecessary object creation.
  3. Increase Overall JVM Memory:

    • If increasing Metaspace size alone does not resolve the issue, consider increasing the overall JVM memory (Heap and Metaspace).
    • Adjust the JVM options for Heap memory using -Xmx and -Xms parameters.
  4. Check for Memory Leaks:

    • Use profiling tools or memory analyzers to identify and address any memory leaks in your AEM application.
  5. Review AEM Configuration:

    • Review the AEM configuration and ensure that it is optimized for performance and memory usage.
    • Check for any misconfigurations or excessive memory usage in AEM components or services.
  6. Monitor and Tune:

    • Monitor the AEM instance regularly for memory usage and performance metrics.
    • Tune the JVM memory settings as needed based on monitoring data and performance testing.

 



Arun Patidar