1 Reply Latest reply on Sep 25, 2009 7:42 AM by feutche

    Cache does not release locked nodes on transaction rollback

    feutche

      Hello, can you advise please on another issue I've got with JBoss-Cache (3.2) used with Atomicos tx server.

      When transaction server calls rollback on jta timeout, locks aren't released, probably because invocation context is not set on atomicos thread

      Here's the scenario:

      1. transaction started (by Spring transaction proxy)
      2. processing is done, cache updated
      3. precommit called - cacheloader writes updates to a database, it takes some time
      4. during precommit phase rollback called by atomicos on timeout
      5. locks are not released during rollback, because:
      rollback is called from atomicos thread
      lockManager.unlock(fqn, owner) is called with right owner (global transaction to be rolled back) but owner is not used in MVCCLockManager
      invocationContextContainer is empty, so OwnableReentrantLock tries current thread as the owner, causing IllegalMonitorException
      6. UnexpectedRollbackException is thrown on commit attempt, no other command issued to rollback so no locks released

      Thanks

        • 1. Re: Cache does not release locked nodes on transaction rollb
          feutche

          So is it a bug in TxInterceptor?:

          Line 923:
          public void afterCompletion(int status)
          {
          // could happen if a rollback is called and beforeCompletion() doesn't get called.
          if (ctx == null)
          {
          ctx = invocationContextContainer.get();
          setTransactionalContext(tx, gtx, transactionContext, ctx);


          if afterCompletion() is called in a different thread than beforeCompletion() was called, then ctx is not null and invocation context is not initialized