1 Reply Latest reply on Mar 17, 2015 7:47 AM by Pedro Ruivo

    Exception during put operation in batch mode

    annapurna samanta Newbie

      Hi,

      After some 10-15 put operation into cache, I am getting TimeOutException exception. I am getting this exception very frequently. Below is my config xml :

       

      <infinispan>

      <global>

        <transport

         transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">

         <properties>

          <property name="configurationFile" value="${cache.external.conf}/jgroup/jgroups.xml" />

         </properties>

        </transport>

      </global>

      <default>

       

        <clustering mode="replication">

         <sync />

         <hash numOwners="1">

          <groups enabled="true" />

         </hash>

        </clustering>

        <indexing enabled="true" indexLocalOnly="true">

               <properties>

                  <property name="default.directory_provider" value="filesystem" />

                  <property name="hibernate.search.default.indexBase" value="${cache.external.conf}/indexes"></property>

               </properties>

            </indexing>

      </default>

      <namedCache name="test1">

        <transaction transactionMode="TRANSACTIONAL" /> 

        <invocationBatching enabled="true" />

        <expiration lifespan="3600000" maxIdle="3600000"/>

        <!-- <transaction

         transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"

         syncRollbackPhase="false" syncCommitPhase="false" useEagerLocking="false" /> -->

       

        <clustering mode="replication">

         <sync />

         <hash numOwners="1">

          <groups enabled="true" />

         </hash>

        </clustering>

      </namedCache>

      </infinispan>

       

      Below is my java code for put operation in batch mode :-

       

       

      public boolean putAll(String cacheName, ListOfCacheObjects cacheObjects,boolean transactionValue) {

      boolean data = false;

      Object val=null;

      try {

           cache.startBatch();

           for (CacheObject cacheObject : cacheObjects.getCacheObjects()) {

                val = cache.put(cacheObject.getKey(),cacheObject.getValue());

           }

           cache.endBatch(true);

      }

      catch (Exception e) {

           logger.error("PutAll Tx Failed " ,e );

           cache.endBatch(false);

      }

      return true;

      }

       

      Exception :-

       

      015-02-25 23:57:10,346 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] ISPN000136: Execution error

      org.infinispan.util.concurrent.TimeoutException: Unable to acquire lock after [10 seconds] on key [Hyperic-10628-INFYAFSMOSASP51.ampcloud.au-1424926560000] for requestor [GlobalTransaction:<ip-10-4-9-190-27195>:6419:local]! Lock held by [GlobalTransaction:<ip-10-4-9-190-27195>:6416: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:169)

              at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockAndRegisterBackupLock(AbstractTxLockingInterceptor.java:98)

              at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.acquireAllLocks(OptimisticLockingInterceptor.java:262)

              at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitPrepareCommand(OptimisticLockingInterceptor.java:84)

              at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:124)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)

              at org.infinispan.interceptors.NotificationInterceptor.visitPrepareCommand(NotificationInterceptor.java:36)

       

       

      015-02-25 23:57:10,348 ERROR [org.infinispan.transaction.TransactionCoordinator] ISPN000255: Error while processing prepare

      org.infinispan.util.concurrent.TimeoutException: Unable to acquire lock after [10 seconds] on key [Hyperic-10628-INFYAFSMOSASP51.ampcloud.au-1424926560000] for requestor [GlobalTransaction:<ip-10-4-9-190-27195>:6419:local]! Lock held by [GlobalTransaction:<ip-10-4-9-190-27195>:6416: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:169)

              at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockAndRegisterBackupLock(AbstractTxLockingInterceptor.java:98)

              at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.acquireAllLocks(OptimisticLockingInterceptor.java:262)

              at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitPrepareCommand(OptimisticLockingInterceptor.java:84)

              at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:124)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)

              at org.infinispan.interceptors.NotificationInterceptor.visitPrepareCommand(NotificationInterceptor.java:36)

              at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:124)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)

       

       

       

      015-02-25 23:57:10,349 ERROR [org.infinispan.transaction.tm.DummyTransaction] ISPN000109: beforeCompletion() failed for SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, lockedKeys=null, backupKeyLocks=null, topologyId=0, isFromStateTransfer=false} org.infinispan.transaction.synchronization.SyncLocalTransaction@1913} org.infinispan.transaction.synchronization.SynchronizationAdapter@1932

      org.infinispan.commons.CacheException: Could not prepare.

              at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:46)

              at org.infinispan.transaction.tm.DummyTransaction.notifyBeforeCompletion(DummyTransaction.java:208)

              at org.infinispan.transaction.tm.DummyTransaction.runPrepare(DummyTransaction.java:220)

              at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:64)

              at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:80)

       

       

      aused by: javax.transaction.xa.XAException

              at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:139)

              at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:101)

              at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:44)

              ... 26 more

       

       

      015-02-25 23:57:10,351 ERROR [com.infy.ceh.management.cache.service.impl.CacheServiceImpl] PutAll Tx Failed

      org.infinispan.commons.CacheException: Unable to end batch

              at org.infinispan.batch.BatchContainer.endBatch(BatchContainer.java:85)

              at org.infinispan.batch.BatchContainer.endBatch(BatchContainer.java:64)

              at org.infinispan.CacheImpl.endBatch(CacheImpl.java:777)

              at com.infy.ceh.management.cache.service.impl.CacheServiceImpl.putAll(CacheServiceImpl.java:107)

       

      aused by: javax.transaction.RollbackException: Exception rolled back, status is: 9

              at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:67)

              at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:80)

              at org.infinispan.batch.BatchContainer.resolveTransaction(BatchContainer.java:101)