0 Replies Latest reply on Jul 21, 2009 8:42 AM by Matthew Greet

    Workspace node version is 1 after repeated optimistic lockin

    Matthew Greet Newbie

      In my code using JBoss Cache v1.4.1SP9, a load test fails with the cause

      org.jboss.cache.optimistic.DataVersioningException: DataNode [/ItemCache/com.afl.uefa.billing.card.util.cache.AccountClusteredItemCache/141] version Ver=2 is newer than workspace node Ver=1

      This looks like an optimistic locking conflict but my code already handles this by sleeping for half a second and retrying up to five times. I suspect the load test fails because it creates 20 threads, they all try to write the same value to the same node at the same time and the fixed retry delay means all the lock losers retry at the same time.

      This suggests an obvious solution but the error log suggests my theory is wrong. The lock losing threads should be giving up after the fifth attempt but the lock winning threads would have incremented the actual node version to 6. It could be that the version is not incremented whenever setting the node's value with a new value that's equal to it. Can anyone confirm this? Is there a different explanation for the version being 2?