putting, removing, and rolling back in the same transaction
visionlink Oct 15, 2004 7:29 PMi'm using JBCv1.1 for the hibernate secondary-cache implementation. i'm getting a catastrophic exception when a rollback occurs in certain situations. it is catastrophic because locks are left locked and orphaned and the tree is generally in an inconsistent state.
the problem is triggered by putting an Fqn, removing the same Fqn, removing the same Fqn again, then rolling back the transaction. granted, that's sort of a goofy access pattern, however, no *reasonable* access pattern should leave the tree in an inconsistent state such as this.
the following simple program should be sufficient to cause the problem (i hope):
import org.jboss.cache.TreeCache; import org.jboss.cache.DummyTransactionManagerLookup; import org.jboss.cache.transaction.DummyUserTransaction; import org.jboss.cache.transaction.DummyTransactionManager; import javax.transaction.UserTransaction; /** * */ public class foo { public static void main(String[] argv) throws Exception { TreeCache tc; UserTransaction tx; tc = new TreeCache(); tc.setTransactionManagerLookup(new DummyTransactionManagerLookup()); tc.start(); tx = new DummyUserTransaction(DummyTransactionManager.getInstance()); tx.begin(); tc.put("/foo/1", "item", new Integer(1)); tc.remove("/foo/1"); tc.remove("/foo/1"); tx.rollback(); } }
the exception that you'll (hopefully) see is:
java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:552) at java.util.LinkedList$ListItr.previous(LinkedList.java:508) at org.jboss.cache.TreeCache.rollback(TreeCache.java:2859) at org.jboss.cache.interceptors.TransactionInterceptor$SynchronizationHandler.afterCompletion(TransactionInterceptor.java:111) at org.jboss.cache.interceptors.OrderedSynchronizationHandler.afterCompletion(OrderedSynchronizationHandler.java:79) at org.jboss.cache.transaction.DummyTransaction.notifyAfterCompletion(DummyTransaction.java:240) at org.jboss.cache.transaction.DummyTransaction.rollback(DummyTransaction.java:82) at org.jboss.cache.transaction.DummyTransactionManager.rollback(DummyTransactionManager.java:137) at org.jboss.cache.transaction.DummyUserTransaction.rollback(DummyUserTransaction.java:80) at foo.main(foo.java:26)
thanks, and let me know if there are any other details that you need to be able to debug this.