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

Create API that enables releasing a session from an operation context's recovery unit

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • Execution Team 2025-01-06

      The goal in SERVER-96701 is to create a new policy around the WiredTigerSessionCache shutting down wherein
      A) A WiredTigerSession cannot be checked out from the session cache while the cache is shutting down;
      B) The session cache cannot be shut down while a WiredTigerSession that has been checked out of the cache has not been returned to the cache

      Currently, if an OperationContext has a recovery unit that has a WiredTigerSession checked out, that session will not be released back into the cache until the recovery unit is destructed. This can create self-deadlocks with the above-described policy where in places like this, in the shutdown path, the OperationContext in the scope of the shutdownTask function has its session still checked out while we call into the storage engine shutdown code.

      One hacky way of getting around this is to destruct the recovery unit likeso:

      {
           // This should destruct any session on the recovery unit
          auto ru = opCtx->releaseRecoveryUnit_DO_NOT_USE();
      }
      

      But this shouldn't be the official way of accomplishing this.
      This ticket would look into creating some form of API for releasing the session back into the cache in situations like this. This could either expose the API for releaseSession() to a higher level, or create some form of workaround for otherwise destructing the recovery unit once we no longer need it from the operation context.

            Assignee:
            damian.wasilewicz@mongodb.com Damian Wasilewicz
            Reporter:
            damian.wasilewicz@mongodb.com Damian Wasilewicz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: