While applying AEM6.2 CFP, the system hangs on membership lookups.

Issue

While applying AEM 6.2 SP1-CFP9, the system hangs on membership lookups. In the logs, error messages like the one below are observed:

28.11.2017 23:28:23.173 *ERROR* [qtp1878999246-18233] org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage Error during install.
java.lang.UnsupportedOperationException: The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.
at org.apache.jackrabbit.oak.query.FilterIterators.checkReadLimit(FilterIterators.java:66)
at org.apache.jackrabbit.oak.spi.query.Cursors$TraversingCursor.fetchNext(Cursors.java:324)
at org.apache.jackrabbit.oak.spi.query.Cursors$TraversingCursor.next(Cursors.java:303)
at org.apache.jackrabbit.oak.query.ast.SelectorImpl.next(SelectorImpl.java:430)
at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.fetchNext(QueryImpl.java:820)
at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.hasNext(QueryImpl.java:845)
at com.google.common.collect.TransformedIterator.hasNext(TransformedIterator.java:43)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:645)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at org.apache.jackrabbit.oak.security.user.MembershipProvider$AbstractMemberIterator.getNext(MembershipProvider.java:443)
at org.apache.jackrabbit.oak.security.user.MembershipProvider$AbstractMemberIterator.getNext(MembershipProvider.java:429)
at org.apache.jackrabbit.commons.iterator.AbstractLazyIterator.hasNext(AbstractLazyIterator.java:39)
at com.google.common.collect.Iterators.indexOf(Iterators.java:771)
at com.google.common.collect.Iterators.any(Iterators.java:679)
at com.google.common.collect.Iterators.contains(Iterators.java:197)
at org.apache.jackrabbit.oak.security.user.MembershipProvider.hasMembership(MembershipProvider.java:209)
at org.apache.jackrabbit.oak.security.user.MembershipProvider.isMember(MembershipProvider.java:288)
at org.apache.jackrabbit.oak.security.user.UserValidator.checkForCyclicMembership(UserValidator.java:194)
at org.apache.jackrabbit.oak.security.user.UserValidator.propertyChanged(UserValidator.java:119)
at org.apache.jackrabbit.oak.spi.commit.VisibleValidator.propertyChanged(VisibleValidator.java:90)
at org.apache.jackrabbit.oak.spi.commit.VisibleValidator.propertyChanged(VisibleValidator.java:90)
at org.apache.jackrabbit.oak.spi.commit.VisibleValidator.propertyChanged(VisibleValidator.java:90)
at org.apache.jackrabbit.oak.spi.commit.VisibleValidator.propertyChanged(VisibleValidator.java:90)
at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.propertyChanged(CompositeEditor.java:91)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyChanged(EditorDiff.java:93)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareProperties(SegmentNodeState.java:597)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:491)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:414)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:584)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord$3.childNodeChanged(MapRecord.java:440)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:483)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:432)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:584)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:414)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:584)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:483)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:584)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:52)
at org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)
at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:61)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.prepare(SegmentNodeStore.java:494)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.optimisticMerge(SegmentNodeStore.java:525)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.execute(SegmentNodeStore.java:581)
at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore.merge(SegmentNodeStore.java:238)
at org.apache.jackrabbit.oak.spi.state.ProxyNodeStore.merge(ProxyNodeStore.java:43)
at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:247)
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)
at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)
at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)
at org.apache.jackrabbit.vault.fs.io.Importer.applyMemberships(Importer.java:1069)
at org.apache.jackrabbit.vault.fs.io.Importer.run(Importer.java:445)
at org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage.extract(ZipVaultPackage.java:234)
at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:397)
at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:356)
at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:502)
at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.extract(JcrPackageImpl.java:356)
at org.apache.jackrabbit.vault.packaging.impl.JcrPackageImpl.install(JcrPackageImpl.java:350)
at com.day.crx.packaging.impl.J2EEPackageManager.consoleInstall(J2EEPackageManager.java:354)
at com.day.crx.packaging.impl.J2EEPackageManager.doPost(J2EEPackageManager.java:192)
at com.day.crx.packaging.impl.PackageManagerServlet.doPost(PackageManagerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)

Environment

AEM 6.2

Cause

This error message is due to a known performance issue within the Oak repository that is resolved in Oak versions 1.4.8 and later.

Resolution

Apply the latest Oak Cumulative Fix Pack. Before installing the Oak CFP, make sure to follow the Pre-deployment Procedure for Oak 1.4.8+ from [1] first.