org.infinispan.persistence.async.AdvancedAsyncCacheLoader$process creates a HashSet, and passes it to loadAllKeys().
loadAllKeys() creates a task to get each key and add it to the HashSet.
This task is run by org.infinispan.persistence.file.SingleFileStore#process, which runs it in multiple threads at once (one thread per key).
There is no synchronization on that HashSet that is shared by the multiple threads.
HashSet is not thread safe. One known side effect of non-synchronized access by multiple threads is infinite loops, which has been witnessed here.
- use Collections.synchronizedSet or another other thread-safe structure
- synchronize on the set around the only multi-threaded access to it in loadAllKeys$CacheLoaderTask#processEntry
Could you please tell me what is the configuration in this case (I'm especially interested which CacheLoader is used underneath) ?
It's using the <singleFile> cache store.
The issue was seen during a cache.entrySet() call.
Also relevant -- the loader is configured for async.
<async enabled="true" threadPoolSize="5" .../>
The issue occurs with the local file store , but other stores should be examined for this possible race condition.
As the # of entries in the cache increases, the odds of hitting it again increase also.
Sebastian Łaskawiec <slaskawi> updated the status of jira ISPN-6276 to Closed
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions