Issue

AEM either crashes with an OutOfMemoryError, is running constant java garbage collection or is showing high heap utilization. On analysis of a heap dump in Eclipse Memory Analyzer Tool, the top consumer of java heap, an AsyncIndexUpdate thread is consuming the most retained heap via an instance of org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexInput:

rtaimage_2_
rtaimage_3_

Environment

AEM 6.1 / Oak 1.2.x and AEM6.2 / Oak 1.4.x

Cause

It is due to a known bug in Oak repository.

Resolution

The issue can be fixed by enabling Copy on Write feature of the Lucene Index Provider in AEM following the below steps:

  1. Go to http://aem-host:port/system/console/configMgr and log in as admin
  2. Find the "Apache Jackrabbit Oak LuceneIndexProvider" configuration
  3. Enable the checkbox for "Enable CopyOnWrite"
  4. Save