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

Signal all threads waiting for checking out session on session checkin

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.1.7
    • None
    • Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2018-12-17, Repl 2019-01-14
    • 45

    Description

      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.

      Attachments

        Activity

          People

            siyuan.zhou@mongodb.com Siyuan Zhou
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: