2 Replies Latest reply on Nov 30, 2007 12:25 PM by Babak Mozaffari

    org.jboss.cache.lock.TimeoutException: write lock for / coul

    Babak Mozaffari Newbie

      Hi all,

      I'm trying to use JBoss Cache with optimistic locking as 2nd level cache for hibernate. I have a test case where a multi-threaded client inserts new objects into the database, with a database auto-sequence primary key. My test case passes with no issues when using pessimistic locking, but as soon as I switch to optimistic locking, I get the following:

      17:47:25,831 WARN [TreeCache] replication failure with method_call optimisticPrepare; id:18(GlobalTransaction:<>:14, [_put; id:38(GlobalTransaction:<>:14, /EntityBean_jar,SimpleEntityBean/com/intuit/spc/bhp/entity/SimpleEntityBean/com.intuit.spc.bhp.entity.SimpleEntityBean#3144, item, CacheEntry(com.intuit.spc.bhp.entity.SimpleEntityBean)[Thu Nov 29 17:47:10 PST 2007,1234567890], true, org.jboss.ejb3.entity.OptimisticJBCCache$DataVersionAdapter@1e3e4c5 [current=Thu Nov 29 17:47:10 PST 2007, previous=null, src=SingleTableEntityPersister(com.intuit.spc.bhp.entity.SimpleEntityBean)])], null,, false) exception
      org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/, caller=GlobalTransaction:<>:14, lock=write owner=GlobalTransaction:<>:14 (activeReaders=0, activeWriter=WorkerThread#3[], waitingReaders=0, waitingWriters=1, waitingUpgrader=0)

      Please note that I have 4 client threads (JMeter) sending requests in through a JSP that calls an SLSB, but there should be no concurrency issue, given that all request amount to database inserts and it's the same entity bean for all of them, thereby making the cache objects peers (one is not the parent of another). The error message implies that the cache is writing or updating something at the root, but I don't know why that would be.

      My SLSB code looks like this:
      SimpleEntityBean entityBean = new SimpleEntityBean();
      return entityBean.getId();

      Your thoughts / suggestions would be greatly appreciated!

      Thanks, Babak

        • 1. Re: org.jboss.cache.lock.TimeoutException: write lock for /
          Brian Stansberry Master

          Hi Babak,

          What versions of AS and JBoss Cache are you using?

          Also, you should have access to the Customer Support Portal; it's may be better if you open a case there and communicate that way as you get a 2 hour SLA and can easily do things like attach logs. You got lucky here that I happened to check my e-mail folder with forum posts.

          • 2. Re: org.jboss.cache.lock.TimeoutException: write lock for /
            Babak Mozaffari Newbie

            Hi Brian,

            This is actually for Intuit, whom I believe you're familiar with. I am only here for another couple of hours. I've used the support portal quite a few times before, and have unfortunately concluded that it will not help me when time is limited... so the forum post was a shot in the dar. I will ask Bill DeCoste to follow up if the client is interested in further pursuing this.

            I tested this with JBoss 4.2.0, with JBoss Cache 1.4.1 SP3 and hiibernate 3.2.3GA. I even tried dropping in the latest SP for JBC, but nothing changed.

            Regards, Babak