Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Concurrency Modification exception

Avatar

Level 4

I am getting concurrencyModificationException when I try to iterate through Authorizable.declaredMemberOf() which is OOTB.
The issue occurs intermittently and not always . I am not modifying the original list any where.  
Please let me know what should be done in this case.


Please see some stack trace here : 

Caused by: java.util.ConcurrentModificationException: null

        at java.util.HashMap$Ha**bleep**erator.nextNode(Unknown Source)

        at java.util.HashMap$KeyIterator.next(Unknown Source)

        at org.apache.jackrabbit.oak.security.authorization.permission.PermissionEntryProviderImpl.loadEntries(PermissionEntryProviderImpl.java:163) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.security.authorization.permission.PermissionEntryProviderImpl.getEntries(PermissionEntryProviderImpl.java:142) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.getGroupEntries(CompiledPermissionImpl.java:579) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.access$1400(CompiledPermissionImpl.java:459) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$LazyIterator.getNext(CompiledPermissionImpl.java:624) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$LazyIterator.getNext(CompiledPermissionImpl.java:589) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.commons.iterator.AbstractLazyIterator.hasNext(AbstractLazyIterator.java:39) [org.apache.jackrabbit.jackrabbit-jcr-commons:2.16.3]

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

        at org.apache.jackrabbit.oak.security.authorization.permission.CompiledPermissionImpl$TreePermissionImpl.canRead(CompiledPermissionImpl.java:531) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.core.SecureNodeBuilder$ReadablePropertyPredicate.apply(SecureNodeBuilder.java:384) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.core.SecureNodeBuilder.getProperty(SecureNodeBuilder.java:180) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.getProperty(AbstractTree.java:251) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.core.MutableTree.getProperty(MutableTree.java:128) [org.apache.jackrabbit.oak-core:1.8.7]

        at org.apache.jackrabbit.oak.plugins.tree.TreeUtil.getStringInternal(TreeUtil.java:116) [org.apache.jackrabbit.oak-security-spi:1.8.7]

        at org.apache.jackrabbit.oak.plugins.tree.TreeUtil.getPrimaryTypeName(TreeUtil.java:88) [org.apache.jackrabbit.oak-security-spi:1.8.7]

        at org.apache.jackrabbit.oak.spi.security.user.util.UserUtil.isType(UserUtil.java:63) [org.apache.jackrabbit.oak-security-spi:1.8.7]

        at org.apache.jackrabbit.oak.security.user.AuthorizableBaseProvider.getByPath(AuthorizableBaseProvider.java:72) [org.apache.jackrabbit.oak-core:1.8.7]

     

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The same issue reported here -https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/concurrentmodificationexce...

 

Review and and see if this resolve the issue.

 

Regards

Albin I

 

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

The same issue reported here -https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/concurrentmodificationexce...

 

Review and and see if this resolve the issue.

 

Regards

Albin I

 

Avatar

Level 4

Hi Albin,

 

I have visited the given link , but unfortunately it doesn't resolve my issue. 
 It gives the exception in OOTB classes when we are doing iterator.next() ,hence i am unsure about it.

 

Thanks,

Pallavi 

Avatar

Community Advisor

Please post the code used to iterate the details

 

Regards

Albin

Avatar

Employee

@Albin_Issacif you look at the stack trace the the HashMap throwing the exception is from Apache Jackrabbit Oak code at org.apache.jackrabbit.oak.security.authorization.permission.PermissionEntryProviderImpl.loadEntries(PermissionEntryProviderImpl.java:163) [org.apache.jackrabbit.oak-core:1.8.7]

 

I filed an issue for this, if possible, please update with more details on the issue:

https://issues.apache.org/jira/browse/OAK-9117

Avatar

Level 4

@Albin_Issac  : 
The code iterates through user groups . 

User user = (User) userManager.getAuthorizable("userId");

Iterator<Group> groups = user.declaredMemberOf();
while (groups.hasNext()) {
Group group = groups.next();
//some logic goes here..
}

 

@Andrew_Khoury  : Thanks for creating a ticket. 
Yes ,the issue comes OOTB classes , so we are unable to trace it out.

Avatar

Community Advisor
@Andrew_Khoury thanks for the ticket, let me review and add if any additional details required