We are using TreeCache with NodeLockingScheme=OPTIMISTIC, IsolationLevel=REPEATABLE_READ, CacheMode=INVALIDATION_ASYNC
I'm having a hard time understanding how versioning works, and if it has some relation to equals/hashcode/tostring of our model objects (the ones that are mapped with hibernate). I have the following scenario in JMeter: 50 threads running simultaneously, searching for objects, creating new objects and persisting them. Only one instance of JBoss is running.
Around 20% of the time we get the folling exception:
Caused by: org.jboss.cache.CacheException: DataNode [/a/b/c/d/Telephone] version Ver=41 is newer than workspace node Ver=40
As far as I understand, after a "put" there should be an "evict" so this situation shouldn't occur unless 2 threads update the same object simultaneously (however, we are creating different objects all the time)
When I run with 10 threads or so the error does not occur.
Hibernate is 3.2, JBoss is 4.0.4 and JBossCache 1.4
The problem you see is a manifestation of http://opensource.atlassian.com/projects/hibernate/browse/HHH-1796.
The way Hibernate organised data in the cache was not very optimal for concurrent access. This will change with Hibernate 3.2.0 which has yet to be released.
See the link above for details, as the fix should be available in 3.2.0.CR3 when it is released.