2 Replies Latest reply on Jan 4, 2012 1:41 PM by matlach

    keys locked forever

    matlach

      Hello,

       

      I'm currently encountering an issue with keys getting locked forever while using distributed cache.

       

      Here's my scenario :

      1. client make a request to the server.

       

      2. request go trough a proxy to encapsulate pessimistic transaction over the default cache :

      // begin transaction

      try{

        defaultCache.getAdvancedCache().getTransactionManager().begin();

      } catch (Exception e){

         throw e;

      }

      try{

         // do stuff

        Object o = method.invoke(...);

        // commit

         try{

           defaultCache.getAdvancedCache().getTransactionManager().commit();

         } catch (Exception e) {

           throw e;

         }

      } catch (Exception e){

         // rollback

         try{

           defaultCache.getAdvancedCache().getTransactionManager().rollback();

         } catch (Exception e){

           // log as error

          // do not throw

         }

      }

      return o;

       

      default cache is only used for it's transactionnal aspect (no data is ever stored in it) and configured like this :

      // transaction

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

      autoCommit="false"

      useSynchronization="true"

      transactionMode="TRANSACTIONAL"

      syncCommitPhase="true"

      useEagerLocking="true"

      eagerLockSingleNode="true"

      syncRollbackPhase="false"

      lockingMode="PESSIMISTIC"

      // clustering

      mode="local"

       

      3. in the "do stuff process" i'll have potentially many interactions with differents sync cache (either local or distributed) which locking is managed per cache and configured as follow :

      // clustering

      mode="local"

      // l1

      enabled="false"

      // locking

      writeSkewCheck="false"

      lockAcquisitionTimeout="10000"

      isolationLevel="READ_COMMITTED"

      useLockStriping="false"

      concurrencyLevel="32"

       

      4. under high load, if a certain cache key get locked it will forever, and each subsequent attempt to lock the same key will result in a lock acquisition timeout exception.

       

      Could my issue related to : https://issues.jboss.org/browse/ISPN-445

       

      Do I manage properly exception in my proxy ? I haven't found any documentation on how exception should be managed.

      Do the presented use case seems viable (default cache for transaction, multiple sync cache for data)  ?

      Is the configuration appears alright for the presented use case ?

      Can actually rollback fail ? What can we do to actually try to prevent it ? Is it any way to fix broken transaction / stalled keys without using recovery service ; to force unlock key ?

       

      Thanks a lot for your time,