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

killSessionsLocalKillTransactions must filter for sessions with running transactions

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Replication, Sharding
    • None
    • Fully Compatible
    • ALL
    • Sharding 2019-01-14, Sharding 2019-01-28, Sharding 2019-02-11, Sharding 2019-02-25, Sharding 2019-03-11
    • 62

      In stepdown, we enqueue an RSTL X lock and then kill all running transactions by calling killSessionsLocalKillTransactions(). This visits every session in the session catalog, kills the operation that has the session checked out, waits for the session to be checked in, checks out the session, then aborts any running transaction. However, if the operation is a retryable write, then it can perform query yielding, which reacquires locks in an UninterruptibleLockGuard. An operation cannot be killed while it is in an UninterruptibleLockGuard, and it will not check the session back in until it has reacquired the lock (which it cannot, since there is an RSTL X lock enqueued). This problem also occurred when the Global X lock was used to guard state transitions.

      I recommend solving this by changing the filter that killSessionsLocalKillTransactions() supplies to killSessionsAction() so that it only attempts to visit operations with running multi-document transactions. Multi-document transactions never yield locks, so they will not attempt to reacquire locks in an UninterruptibleLockGuard.

            Assignee:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: