[infinispan-issues] [JBoss JIRA] (ISPN-5104) Infinite loop in TransactionAwareCloseableIterator when iterating through cache...
Christian Niessner (JIRA)
issues at jboss.org
Mon Dec 22 05:03:29 EST 2014
Christian Niessner created ISPN-5104:
----------------------------------------
Summary: Infinite loop in TransactionAwareCloseableIterator when iterating through cache...
Key: ISPN-5104
URL: https://issues.jboss.org/browse/ISPN-5104
Project: Infinispan
Issue Type: Bug
Components: Transactions
Affects Versions: 7.0.2.Final
Reporter: Christian Niessner
Hi,
i have some testing code that iterates through a cache and validates all data in this cache for consistency.
The reduced code is:
TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
tm.begin();
try {
for (Entry<Object,Object> entry : metadataCache.entrySet()) {
// validation code omitted...
}
} finally {
tm.commit();
}
In some circumstances the iteration starts returning the same Entry every time. I stepped into the code and the value is returned from:
https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/iteration/impl/TransactionAwareCloseableIterator.java#L70
This code block is commented with:
"// We do a last check to make sure no additional values were added to our context while iterating"
And for me it seems that the value returned here never gets added to the "seenContextKeys" Set and so the iterator is always returning the same key.
Maybe a simple "seenContextKeys.add(lookedUpEntry.getKey())" next to Line 70 would fix this issue. Maybe even a 'break' could make sense here because is there the need to walk through the entire list if we have found a candidate?
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the infinispan-issues
mailing list