4 Replies Latest reply on Nov 15, 2004 5:31 AM by duardor

    Error: lock < 0

    duardor

      Hello guys...

      I´m using a JBOSS 3.2.6 in production and doing some really heavy load tests (400+ users).
      In the first attempt , the server enters in a deadlock, I think we must redesing some ways of access the beans.. But we (me and my team) need to put the application in production very fast... So we changed the lock policy to NoLock ... Then a strange error happens sometimes... Sometimes the test finish with success but sometimes we have a exception thrown (Throwable) with a message "lock < 0".
      Searching in the source , I´ve found this in EnterpriseContext.java

       public void unlock() {
      
       // release a lock
       locked --;
      
       //new Exception().printStackTrace();
       if (locked <0) {
       // new Exception().printStackTrace();
       log.error("locked < 0", new Throwable());
       }
      
       //DEBUG log.debug("EnterpriseContext.unlock() "+hashCode()+" "+locked);
       }
      


      I´m thinking, using the NoLock policy, two different threads possibly enter in this method concurrently and then result in the error... This is a normal situation using the NoLock policy??? Maybe this method (and the lock) must be synchronized??? There is a workaround???

      I´m using the commit option A with many cache optimizations...

      Guys I really need help here...

      Thank you so much

      Eduardo Rodrigues

        • 1. Re: Error: lock < 0
          aloubyansky

          NoLock policy can't be used with commit option A. See wiki CMP caching page.

          • 2. Re: Error: lock < 0
            duardor

            Thank you so much!
            If we change the commit opton to B the performance will be affected badly, am I right??? At least , the system probably will work...

            We are having another problem, related to use a CMR iterator in a different transaction... I think that changing the commit option to B and using a Instance per Transaction will fix this issue too, am I right???

            Thank you soh much, you JBOSS guys are making a great work!

            Bye

            Eduardo Rodrigues

            • 3. Re: Error: lock < 0
              aloubyansky

              As to the performance, just test it as it depends on lot of factors.
              As to the CMR, make sure the field access and collection iteration is done in the same tx.

              • 4. Re: Error: lock < 0
                duardor

                Thank you so much.
                I will try to change the commit option to B. Later I´ll return with feedback and some numbers....
                Again, thank you so much.

                Bye,

                Eduardo Rodrigues