Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2427

Infinispan cache commit failures do not propagate to Modeshape when synchronizations are used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • Future Releases
    • 4.1.0.Final
    • Transactions
    • None
    • Hide

      I am unable to provide a test case that forces a cache store write to fail but the following steps can be used to reproduce the issue:

      1.Create a new node using Modeshape backed by a JDBC cache store
      2. Attach a debugger to the JVM and place a break point in JdbcStringBasedStore on line 157
      3. Modify the value of the sql variable to contain bad SQL
      4. Release the breakpoint
      5. Verify the Tx commits successfully
      6. Attempt to retrieve the node in a new Tx, it will not exist.

      Show
      I am unable to provide a test case that forces a cache store write to fail but the following steps can be used to reproduce the issue: 1.Create a new node using Modeshape backed by a JDBC cache store 2. Attach a debugger to the JVM and place a break point in JdbcStringBasedStore on line 157 3. Modify the value of the sql variable to contain bad SQL 4. Release the breakpoint 5. Verify the Tx commits successfully 6. Attempt to retrieve the node in a new Tx, it will not exist.

    Description

      If an error occurs during the commit-phase of the Infinispan transaction (NON_XA, pessimistic, READ_COMMITTED) the Infinispan cache does not get updated and instead throws the following exception:

      09:59:42,512 WARN  [com.arjuna.ats.jta] (default task-34) ARJUNA016029: SynchronizationImple.afterCompletion - failed for SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, lockedKeys=null, backupKeyLocks=null, topologyId=0, isFromStateTransfer=false} org.infinispan.transaction.synchronization.SyncLocalTransaction@6} org.infinispan.transaction.synchronization.SynchronizationAdapter@25 with exception: org.infinispan.commons.CacheException: Could not commit.
      	at org.infinispan.transaction.synchronization.SynchronizationAdapter.afterCompletion(SynchronizationAdapter.java:60) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
      	at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:96) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:532) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:101) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
      	at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.endTransaction(TransactionalInterceptorBase.java:147) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:93) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      	at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequiresNew.intercept(TransactionalInterceptorRequiresNew.java:54) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
      

      This error does not change the status of the transaction (COMMITTED=7) and the modeshape transaction synchronization implementation proceeds with executing it's afterCommit() logic. No errors are returned to the application tier and the transaction appears to be successful which means the application reports the modification as successful to the user.

      Subsequent attempt to access the changes in a new session/Tx fail because the changes are not in the Infinispan cache.

      This appears to be expected behavior when using synchronizations and an error occurs during the commit-phase. It should not impact the transactions status and any other registered synchronizations should still be called. Given this the idea is to not perform any operations in the commit phase that are likely to fail, instead these should be done in the prepare phase.

      The problem is that Infinispan does it's writes to the cache stores (file/jdbc/etc) during the commit-phase and these do fail intermittently for a multitude of reasons (I've seen this when I exhaust my JDBC connection pool).

      Given this is there anything that can be done in the Modeshape tier to verify a modification after the Tx commits and propagate an error to the application tier ?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ma6rl_jira Richard Lucas (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: