2 Replies Latest reply on Feb 15, 2002 2:56 AM by wolfc

    Synchronization of the entity cache

    wolfc

      I'm running Jboss 2.2.2 for some time now. Recently traffic has increased after which I started to get a lot of the following exceptions. I looked through the source of 2.2.2 and 2.4.3 and it looks like the entity cache is not thread safe (enough). Can anybody confirm or deny this?

      TRANSACTION ROLLBACK EXCEPTION:null; nested exception is: javax.ejb.EJBException
      java.lang.IllegalArgumentException: Requesting an object using a null key
      at org.jboss.util.LRUCachePolicy.peek(LRUCachePolicy.java:133)
      at org.jboss.ejb.plugins.AbstractInstanceCache.release(AbstractInstanceCache.java:222)
      at org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy.ageOut(LRUEnterpriseContextCachePolicy.java:234)
      at org.jboss.util.LRUCachePolicy$LRUList.demote(LRUCachePolicy.java:337)
      at org.jboss.util.LRUCachePolicy.insert(LRUCachePolicy.java:153)
      at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:200)
      at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:165)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:639)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:160)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:87)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:164)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:436)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:212)
      at $Proxy128.create(Unknown Source)
      at com. .ejbCreate( .java:49)

      [Container factory] java.lang.IllegalStateException: Cache synchronization bug
      [Container factory] at org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy$OveragerTask.execute(LRUEnterpriseContextCachePolicy.java:384)
      [Container factory] at org.jboss.util.TimerQueue$TimerTaskLoop.run(TimerQueue.java:164)
      [Container factory] at java.lang.Thread.run(Thread.java:484)

      [Container factory] java.lang.IllegalStateException: Attempt to put a new cache entry on a full cache
      [Container factory] at org.jboss.util.LRUCachePolicy$LRUList.promote(LRUCachePolicy.java:295)
      [Container factory] at org.jboss.util.LRUCachePolicy.insert(LRUCachePolicy.java:155)
      [Container factory] at org.jboss.ejb.plugins.AbstractInstanceCache$1.execute(AbstractInstanceCache.java:648)
      [Container factory] at org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:199)
      [Container factory] at java.lang.Thread.run(Thread.java:484)

        • 1. Re: Synchronization of the entity cache
          ddeuchert

          We recently ported a app from weblogic to JBoss. We saw this exception quite a bit when we moved from weblogic. In all cases we found it was our code. Weblogic would throw a finder exception with the following:

          Long key = null;
          SomeObject obj = someHomeReference.findByPrimaryKey(key);

          JBoss seems more strict (IMHO that is a very good thing) and was throwing the null key exception.

          I would double check your code to ensure you are not passing null keys to your finder methods.

          Hope this helps...

          Dave

          • 2. Re: Synchronization of the entity cache
            wolfc

            Thx for the reply.
            As you can see in the stack trace my own bean doesn't get called at all. It goes wrong before it gets to the ejbCreate.