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

Killing a session with a transaction can cause the thread to throw WriteConflictError

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.3, 4.1.2
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0
    • Sprint:
      Sharding 2018-08-27
    • Linked BF Score:
      45

      Description

      When killSessions is called on a session running a transaction, the transaction is aborted. The command that’s running can return a WriteConflict error that is not labeled with `TransientTransactionError` if the transaction is aborted while a write command is running, causing the thread to throw down the line. I’ve reproduced this with an `update` command in the concurrency suite - if there is a writeConflict caught here, we then check if we’re in a transaction in `handleError()` here . We don’t check if we’ve aborted a transaction though, so we would not throw here in this case, and instead would return the error and not catch the it in writeCommands::run() as we should be doing.

      We can also hit the invariant here for the same reason (if the transaction was aborted slightly earlier).

      We should check if the transaction was aborted and should also look into if the other places we call `inMultiDocumenTransaction()` need to be changed as well.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: