Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-41556

Must handle failure to reacquire locks and ticket when unstashing transaction

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0, 4.3.1
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • v4.2
    • Repl 2019-07-01, Repl 2019-07-15, Repl 2019-07-29
    • 17

      In TxnParticipant::TxnResources::release(OperationContext*), it is possible for either restoring _locker->restoreWriteUnitOfWorkAndLock() or _locker->reacquireTicket(opCtx) to fail. If _locker->reacquireTicket() fails, the locker may be in an inconsistent state (holding locks but not the ticket). Further, because of the swap() we do in TransactionParticipant::Participant::_releaseTransactionResourcesToOpCtx, if either one happens we lose the TxnResources object entirely. If the transaction was prepared, it is now in a prepared state without a stash, which result in a crash next time it is used. If it was not, it's now effectively aborted though not marked as so.

      For prepared transactions we need to ensure a failed release() leaves the transaction as-is. This will work for other operations as well, but usually we abort in the case of transaction errors so we may want to force an abort in that case as well.

            Assignee:
            suganthi.mani@mongodb.com Suganthi Mani
            Reporter:
            matthew.russotto@mongodb.com Matthew Russotto
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: