-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
None
-
False
-
-
False
-
-
-
-
-
-
-
The computeIfAbsent method is documented as throwing a ConcurrentModificationException if the mapping function modifies the underlying collection:
However for the HashMap overall:
Note that this implementation is not synchronized. If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:
Errors are reported like:
13:14:57,292 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /omsService/stack/stackrun/byNameAndStatus: java.util.ConcurrentModificationException at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.authz.Attributes$4.get(Attributes.java:658) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.authz.RoleDecoder.lambda$simple$1(RoleDecoder.java:70) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.auth.server.SecurityDomain.mapRoles(SecurityDomain.java:702) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.auth.server.SecurityIdentity.getRoles(SecurityIdentity.java:559) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.auth.server.SecurityDomain.mapPermissions(SecurityDomain.java:724) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.auth.server.SecurityIdentity.<init>(SecurityIdentity.java:98) at org.wildfly.security.elytron-private@1.15.23.Final-redhat-00001//org.wildfly.security.auth.server.ServerAuthenticationContext$NameAssignedState.doAuthorization(ServerAuthenticationContext.java:2053)
In this case the CachingSecurityRealm was in use increasing the chances of concurrent access.
- duplicates
-
JBEAP-30379 [GSS](8.1.z) ELY-2917 - Concurrent access to read only Attributes results in ConcurrentModificationException
-
- Verified
-