3 Replies Latest reply on Sep 17, 2007 9:08 AM by Manik Surtani

    NullPointerException in PessimisticLockInterceptor

    Jacek Halat Newbie

      Hi


      Does anybody seen this exception?

      java.lang.NullPointerException
      at org.jboss.cache.interceptors.PessimisticLockInterceptor.hasBeenRemovedInCurrentTx(PessimisticLockInterceptor.java:342)
      at org.jboss.cache.interceptors.PessimisticLockInterceptor.needToReverseRemove(PessimisticLockInterceptor.java:336)
      at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:300)
      at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:175)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
      at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
      at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
      at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
      at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5863)
      at org.jboss.cache.TreeCache.put(TreeCache.java:3833)
      at org.jboss.cache.aop.PojoCache.lockPojo(PojoCache.java:635)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:461)

      In my opinion TreeCache is yet NOT READY for production use. Probably it works in simple single-thread applications, but in real situations, with many concurent threads TreeCache dosen't work correctly...

        • 1. Re: NullPointerException in PessimisticLockInterceptor
          Elias Ross Master

          It's hard to analyze the problem if you don't provide the version number you're using or the code you're running or the configuration.

          As for sharing your opinion ... I don't know if it's designed to generate a helpful response. Do you want to be helped?

          • 2. Re: NullPointerException in PessimisticLockInterceptor
            Jacek Halat Newbie

            i have analyzed this problem and this is caused by asynchronus transaction rollback. More details in thread:
            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=118186,
            When transaction entry is removed in separate thrad, corresponding TransactionEntry couldn't be foundm, so hasBeenRemovedInCurrentTx, has nul first argument and in first line NPE is thrown.


            private boolean hasBeenRemovedInCurrentTx(TransactionEntry te, Fqn f)
             {
             if (te.getRemovedNodes().contains(f)) return true;
            (...)
            


            Jacek Halat

            • 3. Re: NullPointerException in PessimisticLockInterceptor
              Manik Surtani Master

               

              "jacek187" wrote:

              In my opinion TreeCache is yet NOT READY for production use. Probably it works in simple single-thread applications, but in real situations, with many concurent threads TreeCache dosen't work correctly...


              No, more specifically, it IS ready for production use in multi threaded systems, but cleary does NOT behave well when used with a transaction manager that cleans up timed out transactions in a separate thread - specifically WebLogic's TM. This is evident in some of the JIRAs you have raised (such as JBCACHE-923).

              The solution to this problem is unfortunately not that straightforward, since locks in JBC are obtained either on the Thread (in the case of non-tx operation) or a GlobalTransaction (in the case of running within a tx). Implicit in the design is that only one thread would ever use a GlobalTransaction object at a given time, and this is where it all breaks down when you have a TM that performs rollbacks in a separate thread. It opens up the possibility for the TM to be trying to obtain locks on a node to roll back, while your app thread tries to obtain locks on the same node to write to it. This WILL be allowed since they both pertain to the same GlobalTransaction object.

              Jacek, I'd recommend joining the JBoss Cache dev mail list - we will be discussing this problem in more detail there.

              Cheers,
              Manik