Details
-
Bug
-
Resolution: Done
-
Critical
-
6.0.0.Alpha4
-
None
Description
PersistenceManager.processOnAllStores receives a CacheLoaderTask parameter and calls it on potentially many threads concurrently. So the task object must be thread-safe.
The CacheLoaderTasks used by CacheLoaderInterceptor.visitEntrySetCommand/visitKeySetCommand/visitValuesCommand are not thread-safe. They use a HashSet without any synchronization, and when accessed from concurrent threads the map can be corrupted. When this happens, the thread will block in an infinite loop:
"testng-LocalModeNoPassivationTest" prio=10 tid=0x00007f19141ac800 nid=0x622c runnable [0x00007f1902a62000] java.lang.Thread.State: RUNNABLE at java.util.HashMap.put(HashMap.java:498) at java.util.HashSet.add(HashSet.java:217) at java.util.AbstractCollection.addAll(AbstractCollection.java:342) at org.infinispan.interceptors.CacheLoaderInterceptor.visitEntrySetCommand(CacheLoaderInterceptor.java:195) ...