225 TransactionTooOld: TransactionTooOld
MongoDBWhat does it mean?
A command was run inside a multi-document transaction, but its transaction number is older than the latest transaction number the server has seen for that session. In other words, a newer transaction has been started, so this old one is no longer valid.
Why does it happen?
A new transaction was started in the same session before the old one completed, or transaction numbers advanced out of order due to concurrency. It usually happens when a session object is shared incorrectly or multiple threads use the same session.
How to fix it
Manage the session lifecycle correctly for each logical transaction; do not share a session concurrently across multiple threads. Run transactions with the driver's recommended withTransaction/callback API (it handles retries and number management). Close the previous transaction with commit/abort before starting a new one.
More from this engine
- 136 CappedPositionLostCapped collection position lost
- 28 PathNotViableCannot use the part of the path to traverse the element
- 216 ElectionInProgressElectionInProgress
- 246 SnapshotUnavailableSnapshotUnavailable
- 257 TransactionTooLargeTransactionTooLarge
- 276 IndexBuildAbortedIndexBuildAborted
- 86 IndexKeySpecsConflictIndexKeySpecsConflict