3 Replies Latest reply on Aug 3, 2003 12:26 AM by jbossuser

    locking issues

    vanitas

      Hi,

      In our web application we had problems with locks and deadlocks.

      Basically in one transaction we do the following:
      * fetch contencts of one table (that is a menu table)
      * do other stuff

      In our test we issue read-only queries only, but in real-life we use read-write access, so switchting to read-only for entity is not possible.

      The problem is that with the PessimisticLocking, a lock is set on every bean reflecting menu table, and thus only one client at a time is processed :(.

      This is really bad for us.

      So we switched off locking (relaying only on db locks) by setting to NoLock policy. We got reentrant errors :( (that is quite clear yet).

      So we switched to OptimisticLocking. But with:
      * modified-strategry - we get reentrant errors - WHY??
      * read-strategy weird things are happening, as we get ObjectNotFoundExceptions and 'IllegalStateException: A CMR collection may only be used within the transction in which it was created' that points us to the thinking that our entity beans content is being modified during single transaction. But we do not issue updates! So WHY this happens???


      All the above problems does not occur when only one client at a time is using our application.

      Is it other way to set 'read commited' isolation level in jboss?

      best regards,
      greg

        • 1. Re: locking issues
          g-avaguy

          Don't know if this will fix, but worth a shot, try the SimpleReadWriteEJBLock.

          We are running into reentrant issues and are trying to discover the most effective way to handle them.

          Good Luck

          • 2. Re: locking issues

            Also, CMR requires a transaction lock, I believe. I'm guessing its because the CMR collection should not be modified while a read is going over it. Makes sense if that's true, but what a pain because it locks the entity beans over the life of the transaction from that point on.

            • 3. Re: locking issues

              I also think that with the SimpleReadWriteEJBLock, CMR collection access will still (under the covers) request a write lock, making it no better than the pessimistic case.