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

After a write skew check failure applications can't rollback

    XMLWordPrintable

Details

    Description

      When having this configuration:

      <transaction
              transactionMode="TRANSACTIONAL"
              transactionManagerLookupClass="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup"/>
          <locking isolationLevel="REPEATABLE_READ" writeSkewCheck="true" />
      

      When a write skew check is failed, the following exception is propagated to the user code:

      org.infinispan.CacheException: Detected write skew - concurrent removal of entry!
      at org.infinispan.container.entries.RepeatableReadEntry.performLocalWriteSkewCheck(RepeatableReadEntry.java:75)
      at org.infinispan.container.entries.RepeatableReadEntry.copyForUpdate(RepeatableReadEntry.java:52)
      at org.infinispan.container.EntryFactoryImpl.wrapEntryForRemove(EntryFactoryImpl.java:133)
      at org.infinispan.interceptors.EntryWrappingInterceptor.visitRemoveCommand(EntryWrappingInterceptor.java:158)
      at org.infinispan.commands.write.RemoveCommand.acceptVisitor(RemoveCommand.java:72)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
      at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitRemoveCommand(OptimisticLockingInterceptor.java:173)
      at org.infinispan.commands.write.RemoveCommand.acceptVisitor(RemoveCommand.java:72)

      The user code is catching the exception, and attempts a rollback. The rollback fails with:

      WARN [jta] (main) ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac11823e:8e2d:4fc39246:2669f, node_name=1, branch_uid=0:ffffac11823e:8e2d:4fc39246:266a4, subordinatenodename=null, eis_name=0 > (TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac11823e:8e2d:4fc39246:2669f, node_name=1, branch_uid=0:ffffac11823e:8e2d:4fc39246:266a4, subordinatenodename=null, eis_name=0 >} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=TransactionImple < ac, BasicAction: 0:ffffac11823e:8e2d:4fc39246:2669f status: ActionStatus.ABORTING >, lockedKeys=null, backupKeyLocks=null, viewId=-1} org.infinispan.transaction.xa.LocalXaTransaction@99a9}) failed with exception code XAException.XAER_NOTA
      javax.transaction.xa.XAException
      at org.infinispan.transaction.xa.TransactionXaAdapter.getLocalTransactionAndValidateImpl(TransactionXaAdapter.java:245)
      at org.infinispan.transaction.xa.TransactionXaAdapter.rollback(TransactionXaAdapter.java:134)
      at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelAbort(XAResourceRecord.java:345)
      at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2876)
      at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2855)
      at com.arjuna.ats.arjuna.coordinator.BasicAction.Abort(BasicAction.java:1618)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.cancel(TwoPhaseCoordinator.java:118)
      at com.arjuna.ats.arjuna.AtomicAction.abort(AtomicAction.java:188)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.rollbackAndDisassociate(TransactionImple.java:1247)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:134)

      as in org.infinispan.transaction.xa.TransactionXaAdapter.getLocalTransactionAndValidateImpl(Xid, XaTransactionTable) the operation

      LocalXaTransaction localTransaction = txTable.getLocalTransaction(xid);

      returns null.

      This happens as the method org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(InvocationContext, WriteCommand) is removing a reference to the local transaction on line 218

      I've removed the cleanup line and it fixes my problem: I'm now correctly able to rollback transactions and try again. Still I'm uncomfortable with that change..

      Attachments

        Activity

          People

            mircea.markus Mircea Markus (Inactive)
            sgrinove Sanne Grinovero
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: