0 Replies Latest reply on Mar 29, 2015 8:21 AM by Yair Ogen

    Transactions are failing on timeout

    Yair Ogen Expert

      I am using version: 7.1.1.Final

       

      Building the cache like this:

       

      GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().transport().defaultTransport().clusterName("my-cluster").addProperty("configurationFile", "jgroups-tcp.xml").build();
      
            DefaultCacheManager manager = new DefaultCacheManager(globalConfig) 
      
         ConfigurationBuilder config = new ConfigurationBuilder()
            .read(manager.getDefaultCacheConfiguration)
            .transaction().transactionManagerLookup(new JBossStandaloneJTAManagerLookup()).transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC)
            .clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(1)
            .build();
      
          manager.defineConfiguration(SESSION_CACHE, config)
          AdvancedCache<String, MyCache> cache = manager.getCache(SESSION_CACHE)
      
      
      

       

      using like this:

       

      sessionsByHouseholdCache.getAdvancedCache.getTransactionManager.begin();
            try {
              MyCache sessionCacheEntry = sessionsByHouseholdCache.getAdvancedCache.withFlags(Flag.FORCE_WRITE_LOCK).get(id)
              sessionsByHouseholdCache.put(id, new MyCache())         
            } finally {
              sessionsByHouseholdCache.getAdvancedCache.getTransactionManager.commit();
            }
      
      

       

       

      Although currently testing with a single node cluster (first to verify functionality works) I get timeouts. Could it be that I have nested transactions that cause a dead-lock? If so - is there API to verify not already in a transaction?

       

      Exception: org.infinispan.util.concurrent.TimeoutException: ISPN000299: Unable to acquire lock after 10 seconds for key hh123 and requestor GlobalTransaction:<YAOGEN-WS01-1997>:5:local. Lock is held by GlobalTransaction:<YAOGEN-WS01-1997>:3:local, while request came from local
      at org.infinispan.util.concurrent.locks.LockManagerImpl.lock(LockManagerImpl.java:198)
      at org.infinispan.util.concurrent.locks.LockManagerImpl.acquireLock(LockManagerImpl.java:171)
      at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockKeyAndCheckOwnership(AbstractTxLockingInterceptor.java:177)
      at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitDataReadCommand(PessimisticLockingInterceptor.java:80)
      at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitGetKeyValueCommand(PessimisticLockingInterceptor.java:68)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:111)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:77)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:322)
      at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:300)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:111)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:77)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.statetransfer.StateTransferInterceptor.handleTopologyAffectedCommand(StateTransferInterceptor.java:233)
      at org.infinispan.statetransfer.StateTransferInterceptor.handleDefault(StateTransferInterceptor.java:217)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:77)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.interceptors.CacheMgmtInterceptor.visitDataReadCommand(CacheMgmtInterceptor.java:103)
      at org.infinispan.interceptors.CacheMgmtInterceptor.visitGetKeyValueCommand(CacheMgmtInterceptor.java:91)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:102)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:71)
      at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:77)
      at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)
      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:333)
      at org.infinispan.cache.impl.CacheImpl.get(CacheImpl.java:423)
      at org.infinispan.cache.impl.DecoratedCache.get(DecoratedCache.java:427)