Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2913

putForExternalRead leaves locks

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.0.Final
    • 5.2.1.Final
    • Transactions
    • None

      In TxDistributionInterceptor.remoteGetAndStoreInL1 locks are acquired. Without a transaction these locks are never released. The cache setup is Dist, Async, L1, 2 Nodes, 1 Owner, Optimistic Locking.

      In AbstractTxLockingInterceptor.visitGetKeyValueCommand locks are released explicitly if outside of transactions. I fixed this problem by doing the same in OptimisticLockingInterceptor.visitPutKeyValueCommand. It is very likely that this doesn't fix all problems. For instance OptimisticLockingInterceptor.visitPutMapCommand or PessimisticLockingInterceptor.

      Cache Config:
      <namedCache name="entity">
      <jmxStatistics enabled="true" />

      <clustering mode="dist">
      <stateTransfer fetchInMemoryState="false" timeout="20000" />
      <async />
      <l1 enabled="true" />
      <hash numOwners="1"/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED"
      lockAcquisitionTimeout="15000" useLockStriping="false" />

      <eviction maxEntries="10000" strategy="LRU" />
      <expiration maxIdle="100000" wakeUpInterval="5000"/>
      <storeAsBinary storeKeysAsBinary="true" storeValuesAsBinary="false" enabled="false" />

      <transaction transactionMode="TRANSACTIONAL" autoCommit="false" lockingMode="OPTIMISTIC"/>
      </namedCache>

      Fixed OptimisticLockingInterceptor.visitPutKeyValueCommand:
      @Override
      public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
      try

      { if (command.isConditional()) markKeyAsRead(ctx, command); return invokeNextInterceptor(ctx, command); }

      catch (Throwable te)

      { throw cleanLocksAndRethrow(ctx, te); }

      finally

      { //with putForExternalRead the value might be put into L1 without a transaction //we need to release any locks for these cases if (!ctx.isInTxScope()) lockManager.unlockAll(ctx); }

      }

              pruivo@redhat.com Pedro Ruivo
              sebastiantusk Sebastian Tusk (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: