[
https://issues.apache.org/jira/browse/FINERACT-2822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113420#comment-18113420
]
Abdalrahman Ehab commented on FINERACT-2822:
--------------------------------------------
I would like to work on this issue
> Prevent concurrent modification of supported cache names
> --------------------------------------------------------
>
> Key: FINERACT-2822
> URL: https://issues.apache.org/jira/browse/FINERACT-2822
> Project: Apache Fineract
> Issue Type: Bug
> Reporter: pranav
> Priority: Minor
>
> SpotBugs 4.9.3 reports a potential concurrency issue in
> SpecifiedCacheSupportingCacheManager after the JDK upgrade from JDK 17 to JDK
> 25.
> The supportedCacheNames field is a LinkedHashSet that can be accessed
> concurrently.
> setSupportedCaches() modifies the set while getCacheNames() exposes a
> collection backed by the same set. Concurrent iteration and modification
> can result in ConcurrentModificationException and unsafe concurrent access.
> The implementation should synchronize access to supportedCacheNames and
> return a snapshot from getCacheNames() so callers cannot iterate over the
> internally mutable set while it is being modified.
> A regression test should verify that concurrent reads and updates do not
> throw an exception.
> h3. Steps to reproduce
> # Create a SpecifiedCachesSupportingCacheManager instance.
> # Add initial supported cache names.
> # Start one thread repeatedly calling getCacheNames() and iterating over
> # Concurrently start another thread repeatedly calling setSupportedCaches()
> # Concurrent iteration and modification can result in
> ConcurrentModificationException
--
This message was sent by Atlassian Jira
(v8.20.10#820010)