1 Reply Latest reply on Oct 26, 2007 7:32 AM by Manik Surtani

    Problem in Optimistic Locking

    Shanthi Shanmugam Newbie

      Hi ,

      I have used pessimisticlocking scheme in jboss cache.I have faced dead lock and time out problem. In Forum I saw that Optimistic locking supports concurrency and it will not lead to dead lock problem . I have changed to optimistic locking .

      But still I am facing the dead lock problem like below

      when CacheInstance1 commits a tx, it issues a local prepare (already holds locks on the nodes) and broadcasts a remote prepare to acquire locks on the other cache instances.

      If at the same time, CacheInstance2 commits a tx ON THE SAME DATA (acquires local locks before CacheInstance1's remote prepare is received) and attempts to do a remote prepare, both caches will deadlock since they both want locks on each other's data.

      More over it is not releasing lock on the nodes once this lock timeout exception comes.It will be released after restarting the server only.

      I saw in the forum that this bug will be fixed in 1.4.1 sp6.When it will be released?

      I am using jboss cache 1.4.1.sp4. Is it bug? Is this issue resolved in 2.0.0 GA?

        • 1. Re: Problem in Optimistic Locking
          Manik Surtani Master

          They both support concurrency; it's just that optimistic locking will allow readers to read while writers write, allowing a *higher level* of concurrency.

          Regarding the deadlock with remote prepares, this is a possibility with both OL and PL, since remote locks are only acquired on prepare and not at the start of a transaction.

          Locks should be released after the transaction times out though; which forum thread are you referring to about this being reported as a bug?