Expand my Community achievements bar.

SOLVED

ConcurrentModificationException

Avatar

Level 4

I am getting a concurrentModificationException when I am trying to run a query. This is just reading the nodes and no actual modification is being done. Our environment configuration is 3 AEM instances cluster on Mongo. Exception details below. Any pointers highly appreciated.

Caused by: java.util.ConcurrentModificationException: null

at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)

at java.util.HashMap$KeyIterator.next(HashMap.java:1466)

at org.apache.jackrabbit.oak.security.authorization.permission.PermissionEntryProviderImpl.loadEntries(PermissionEntryProviderImpl.java:164)

at org.apache.jackrabbit.oak.security.authorization.permission.PermissionEntryProviderImpl.getEntries(PermissionEntryProviderImpl.java:142)

at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.getGroupEntries(CompiledPermissionImpl.java:564)

at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.access$1400(CompiledPermissionImpl.java:444)

at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$LazyIterator.getNext(CompiledPermissionImpl.java:609)

at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$LazyIterator.getNext(CompiledPermissionImpl.java:574)

at org.apache.jackrabbit.commons.iterator.AbstractLazyIterator.hasNext(AbstractLazyIterator.java:39)

at com.google.common.collect.Iterators$5.hasNext(Iterators.java:542)

at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.canRead(CompiledPermissionImpl.java:490)

at org.apache.jackrabbit.oak.core.SecureNodeBuilder.exists(SecureNodeBuilder.java:131)

at org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.exists(AbstractTree.java:225)

at org.apache.jackrabbit.oak.core.MutableTree.exists(MutableTree.java:122)

at org.apache.jackrabbit.oak.query.ast.SelectorImpl.next(SelectorImpl.java:447)

at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.fetchNext(QueryImpl.java:843)

at org.apache.jackrabbit.oak.query.QueryImpl$RowIterator.hasNext(QueryImpl.java:868)

at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.fetch(QueryResultImpl.java:181)

at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl$4.<init>(QueryResultImpl.java:176)

at org.apache.jackrabbit.oak.jcr.query.QueryResultImpl.getNodes(QueryResultImpl.java:169)

at org.apache.sling.jcr.resource.internal.helper.jcr.BasicQueryLanguageProvider.findResources(BasicQueryLanguageProvider.java:81)

at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.findResources(AuthenticatedResourceProvider.java:260)

at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.findResources(ResourceResolverControl.java:456)

at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.findResources(ResourceResolverImpl.java:734)

1 Accepted Solution

Avatar

Correct answer by
Level 10

Use ConcurrentHashMap instead of HashMap

at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)

check https://www.javacodegeeks.com/2011/05/avoid-concurrentmodificationexception.html

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Use ConcurrentHashMap instead of HashMap

at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)

check https://www.javacodegeeks.com/2011/05/avoid-concurrentmodificationexception.html

Avatar

Level 4

Can you please tell me what is the solution for this?  I am also facing same problem when I am iterating throughAuthorizable.declaredMemberOf()().

Avatar

Employee

What version of AEM is this?  What version of oak-core bundle do you see in /system/console/bundles?  I would like to contact Adobe Engineering team for this issue.  I suspect there is a product issue here.

 

See the issue I filed here: https://issues.apache.org/jira/browse/OAK-9117