3 Replies Latest reply on Jul 7, 2005 5:09 PM by ben.wang

    org.jboss.cache.lock.TimeoutException

    canghel

      Hi,

      I get a org.jboss.cache.lock.TimeoutException in the following scenario:
      1. I have 2 cluster nodes: N1 and N2
      2. I have 2 caches: C1 and C2 (both started on both cluster nodes)
      3. I start a new transaction on node N1
      3.1 I put O1 in C1
      3.2 I put O2 in C2
      4. A listener on C2 is called on node N2 (after I put O2 in C2 on N1 - step 3.2)
      4.1 I read O1 (a get call) from C1 - at this point I receive the TimeoutException with details saying that node N1 has already the write lock for O1 so that N2 can not acquire read lock for O1.

      Is this the expected behaviour? Is this a defect?

      Reading O2 from C2 from the C2 listener on N2 (in step 4.1) works but reading O1 from C1 from the C2 listener on N2 leads to deadlock. I would expect that both should work.

      I hope someone can give me some explanations for this scenario.

      Thanks,
      Claudiu Anghel

        • 1. Re: org.jboss.cache.lock.TimeoutException

          If you update on both nodes, locks will be acquired in both places. So it depends on where O1 and O2 are located? If they are under the same fqn, yes, you will have deadlock and rollback will be resulted.

          -Ben

          • 2. Re: org.jboss.cache.lock.TimeoutException
            canghel

            1. O1 and O2 are placed in different caches (C1 and C2 respectively) and they are placed under DIFFERENT fqns
            2. I do not update on both nodes; I update on node N1 objects O1 and O2 in cache C1 respectively C2 and read on node N2 in a C2 listener (triggered by the O2 put on N1) the object O1 from cache C1; during this read I get the TimeoutException with the message that N1 has the write lock (acquired when placing O1 in C1)
            3. I use jboss cache 1.2.1 and jboss 3.2.7

            Is this a defect? Should this scenario work without deadlock?

            thanks,
            Claudiu

            • 3. Re: org.jboss.cache.lock.TimeoutException

              If you can contribute a JUnit case that illustrates this problem, that will help me to troublehoot your problem.

              Thanks,

              -Ben