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

Possible race between session expiration and transaction creation

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      We've been observing odd transaction failures since ramping up an application that uses MongoDB 4.0 transactions. We observe the following:
      1) update, with lsid=X, txnNumber=1, startTransaction=true, autocommit=false
      2) commitTransaction, with lsid=X, txnNumber=1, autocommit=false
      3) wait for at least 30 minutes
      4) update, with lsid=X, txnNumber=2, startTransaction=true, autocommit=false
      5) 2nd update, with lsid=X, txnNumber=2, autocommit=false

      Despite the update in 4 succeeding, the update in 5 fails. We've added some debugging info to our mongod build and observe that when 5 fails, either _activeTxnNumber=1 and _txnState=3, or _activeTxnNumber=-1 and _txnState=0, which would indicate that mongod had seemingly lost the transaction state from 4.

      The actual operation/command doesn't seem matter, as we've observed it with "aggregate" as well.

            Assignee:
            dmitry.agranat@mongodb.com Dmitry Agranat
            Reporter:
            bartle David Bartley
            Votes:
            0 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:
              Resolved: