Signal all threads waiting for checking out session on session checkin

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.1.7
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2018-12-17, Repl 2019-01-14
    • 45
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SessionCatalog::checkOutSession() waits until no one has checked it out AND no one has killed it.

          opCtx->waitForConditionOrInterrupt(sri->availableCondVar, ul, [&sri]() {
              return !sri->session.currentOperation() && !sri->session.killed();
          });
      

      While, SessionCatalog::checkOutSessionForKill only waits until no one has checked it out.

          opCtx->waitForConditionOrInterrupt(
              sri->availableCondVar, ul, [&sri]() { return !sri->session.currentOperation(); });
      

      When a session checks in, the thread only notifies the next one:

          sri->availableCondVar.notify_one();
      

      If both a normal checkout and a checkOutForKill are waiting for the session checkin, however the normal checkout is the first in the queue, it wakes up, realizes the session is killed, and sleeps again. checkOutForKill won't have a chance to wake up. Changing the notify_one to notify_all will fix this problem.

            Assignee:
            Siyuan Zhou
            Reporter:
            Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: